@@ -27,17 +27,21 @@ Credits:
27
27
28
28
### Getting started and learning more
29
29
30
- The [ latest version of HNC is
31
- v0.8.0] ( https://github.com/kubernetes-sigs/multi-tenancy/releases/tag/hnc-v0.8.0 ) .
32
30
To install HNC on your cluster, and the ` kubectl-hns ` plugin on your
33
- workstation, follow the instructions on that page. ** NB: the release is in a
34
- different repo since we are currently migrating to this new repo. HNC v0.9.0
35
- will be released from this repo.**
31
+ workstation, follow the instructions on our release pages.
32
+ * [ Latest version (v0.8.0)] ( https://github.com/kubernetes-sigs/multi-tenancy/releases/tag/hnc-v0.8.0 )
33
+ * Note that this release is in a different repo since we are currently
34
+ migrating to this new repo. HNC v0.9.0 will be released from this repo.
35
+ * Versions of HNC prior to HNC v0.9 are available from our [ old
36
+ repo] ( https://github.com/kubernetes-sigs/multi-tenancy/releases/ )
36
37
37
38
HNC is also supported by the following vendors:
38
39
39
- * GKE: [ install via Config Sync] ( https://cloud.google.com/kubernetes-engine/docs/add-on/config-sync/how-to/installing-hierarchy-controller )
40
- * Anthos: [ install via ACM] ( https://cloud.google.com/anthos-config-management/docs/how-to/installing-hierarchy-controller )
40
+ * GCP: as a part of Hierarchy Controller. [ Install via Config
41
+ Sync] ( https://cloud.google.com/kubernetes-engine/docs/add-on/config-sync/how-to/installing-hierarchy-controller )
42
+ on GKE or [ via
43
+ ACM] ( https://cloud.google.com/anthos-config-management/docs/how-to/installing-hierarchy-controller )
44
+ on Anthos.
41
45
42
46
Once HNC is installed, you can try out the [ HNC
43
47
quickstart] ( docs/user-guide/quickstart.md )
@@ -55,30 +59,17 @@ objects you can't afford to lose (e.g. that aren't stored in a Git repository).
55
59
All HNC issues are assigned to an HNC milestone. So far, the following
56
60
milestones are defined or planned:
57
61
58
- * v1.0 - Likely late Q2 or early Q3 2021: HNC recommended for production use
59
- * [ v0.9] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/milestone/21 ) : move
62
+ * v1.0 - Likely late Q2 or early Q3 2021: HNC recommended for production use.
63
+ * [ v0.9] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/milestone/1 ) : move
60
64
HNC to its own repo; continued stability improvements.
61
- * [ v0.8 - COMPLETE APR 2021] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/20 ) :
62
- incremental stability improvements
63
- * [ v0.7 - COMPLETE DEC 2020] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/18 ) :
64
- introduce exceptions.
65
- * [ v0.6 - COMPLETE OCT 2020] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/14 ) :
66
- introduce the v1alpha2 API and fully automated end-to-end testing.
67
- * [ v0.5 - COMPLETE JUL 2020] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/13 ) :
68
- feature simplification and improved testing and stability.
69
- * [ v0.4 - COMPLETE JUN 2020] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/11 ) :
70
- stabilize the API and add productionization features.
71
- * [ v0.3 - COMPLETE APR 2020] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/10 ) :
72
- type configuration and better self-service namespace UX.
73
- * [ v0.2 - COMPLETE DEC 2019] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/8 ) :
74
- contains enough functionality to be suitable for non-production workloads.
75
- * [ v0.1 - COMPLETE NOV 2019] ( https://github.com/kubernetes-sigs/multi-tenancy/milestone/7 ) :
76
- an initial release with all basic functionality so you can play with it, but
77
- not suitable for any real workloads.
78
- * [ Backlog] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/milestone/9 ) :
79
- all unscheduled work.
65
+ * [ v0.1-v0.8] ( https://github.com/kubernetes-sigs/multi-tenancy/milestones ) :
66
+ see our old repo for details.
80
67
81
- ## Governance
68
+ ## Contact and governance
69
+
70
+ HNC is overseen by the Working Group on Multi-Tenancy (wg-multitenancy). Please
71
+ join us on Slack, mailing lists, and at our meeting at our [ community
72
+ page] ( https://github.com/kubernetes/community/blob/master/wg-multitenancy/README.md ) .
82
73
83
74
This project is goverened by
84
75
[ wg-multitenancy] ( https://github.com/kubernetes-sigs/multi-tenancy ) , and was
@@ -93,191 +84,10 @@ either HNC itself or its documentation. Or, if it's working well for you, let us
93
84
know on the \# wg-multitenancy channel on Slack, or join a wg-multitenancy
94
85
meeting. We'd love to hear from you!
95
86
96
- But if you're looking for a deeper level of involvement, read on...
97
-
98
- ### Developing HNC
99
-
100
- HNC is a small project, and we have limited abilities to help onboard
101
- developers. If you'd like to contribute to the core of HNC, it would be helpful
102
- if you've created your own controllers before using
103
- [ controller-runtime] ( https://github.com/kubernetes-sigs/controller-runtime ) and
104
- have a good understanding at least one non-functional task such as monitoring or
105
- lifecycle management. However, there are sometimes tasks to help improve the
106
- CLI or other aspects of usability that require less background knowledge.
107
-
108
- With that said, if you want to * use* HNC yourself and are also a developer, we
109
- want to know what does and does not work for you, and we'd welcome any PRs that
110
- might solve your problems.
111
-
112
- The main design doc is [ here] ( http://bit.ly/k8s-hnc-design ) ; other design docs
113
- are listed [ here] ( docs/links.md ) .
114
-
115
- ### Prerequisites
116
-
117
- Make sure you have installed the following libraries/packages and that they're
118
- accessible from your ` PATH ` :
119
-
120
- - Docker
121
- - [ kubectl] ( https://kubernetes.io/docs/tasks/tools/install-kubectl/ )
122
- - [ kustomize] ( https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md )
123
- - [ kubebuilder] ( https://kubebuilder.io )
124
- - This [ Github issue] ( https://github.com/kubernetes-sigs/controller-runtime/issues/90#issuecomment-494878527 )
125
- may help you resolve errors you get when running the tests or any other
126
- command.
127
-
128
- If you're using ` gcloud ` and the GCP Container Registry, make sure that ` gcloud `
129
- is configured to use the project containing the registry you want to use, and
130
- that you've previously run ` gcloud auth configure-docker ` so that Docker can use
131
- your GCP credentials.
132
-
133
- If you are developing on MacOS, you will need gnu-sed. Instructions are below:
134
- ```
135
- brew install gnu-sed
136
- ln -s $(which gsed) /usr/local/bin/sed # sym link sed to gsed
137
- ```
138
-
139
- ### Development Workflow
140
-
141
- Once HNC is installed via ` make deploy ` (see next sections), the development
142
- cycle looks like the following:
143
-
144
- - Start a new branch and make all your changes there (this is just the
145
- standard Github flow).
146
- - Make changes locally and write new unit and e2e tests as necessary
147
- - Unit tests are located in the same directory as the code, and either test
148
- the code directly (e.g. in ` internal/object ` ) or use the K8s test env,
149
- which is basically just an apiserver (e.g. in ` internal/reconcilers ` ).
150
- - End-to-end (e2e) tests are located in ` test/e2e/ ` , or other more
151
- special-purpose directories in ` test/ ` . These are basically glorified
152
- ` bash ` scripts with better error checking, and directly invoke ` kubectl ` .
153
- - Ensure ` make test ` passes - this runs unit tests only.
154
- - If you see all tests fail with ` no matches for v1/CRD ` [ error] ( https://gist.github.com/yiqigao217/9394c2aadaa515e82184684a005187af )
155
- , remove your ` /usr/local/kubebuilder/ ` directory and [ reinstall kubebuilder] ( https://book.kubebuilder.io/quick-start.html#installation ) .
156
- - Deploy to your cluster with ` make deploy `
157
- - Test your changes by hand and verify that your changes are working
158
- correctly. Some ways you can do that are:
159
- - Look at logging with ` make deploy-watch `
160
- - Look at the result of the structure of your namespaces with ` kubectl-hns tree -A ` or ` kubectl-hns tree NAMESPACE `
161
- - See the resultant conditions or labels on namespaces by using ` kubectl describe namespace NAMESPACE `
162
- - Run the e2e tests via ` make test-e2e ` . This will take about 10-20m, so go
163
- get a coffee or walk around your house if you're quarantined.
164
- - Note that the deployment must be ready _ before_ you start the tests.
165
- - You need to set the ` HNC_REPAIR ` env var to point to the absolute path of
166
- the manifests used to deploy HNC - either the released versions (e.g.
167
- stored on Github) or the _ full_ path to the local manifests. If these are
168
- not set, we'll skip any tests that include modifying the HNC deployement,
169
- e.g. to bypass webhooks.
170
- - Once you're ready to make a pull request, please follow the following
171
- instructions:
172
- - Each PR should contain _ one commit_ . If you have multiple commits (either
173
- introduced during your development or as a result of comments during the
174
- PR review process), please squash them into a single commit. Force-push
175
- any changes to your fork of this repo.
176
- - Ensure your commit message includes a "Tested:" section explaining in
177
- reasonable detail what you did to test your change.
178
- [ Here] ( https://github.com/kubernetes-sigs/hierarchical-namespaces/commit/ce983662e87264c76f92dbfbab7cef7bd6128837 )
179
- is a good example. A minimal message might be something like "Added new
180
- test; verified that the test failed before my change and passed after it;
181
- ran e2e tests."
182
- - Create the PR. We'll try to reply fairly quickly!
183
- - Make any requested changes (using ` git commit --amend ` and ` git push -f `
184
- to ensure you only have one commit).
185
- - Profit! Or at least, enjoy your feeling of accomplishment.
186
-
187
- If you need to make a larger change, please write your plan down somewhere - for
188
- example, either in a Github issue or in a short Google doc
189
- [ example] ( https://docs.google.com/document/d/17J8icBEDvLLoPT4kQ4ArZcCerRweDY-TpJ48DJKpHJ0 ) .
87
+ But if you're looking for a deeper level of involvement, please check out our
88
+ [ contributors guide] ( docs/contributing.md ) !
190
89
191
- #### Building and deploying to a test cluster
192
-
193
- To build from source and deploy to a cluster:
194
- - Ensure your ` kubeconfig ` is configured to point at your cluster
195
- - On GKE, run `gcloud container clusters get-credentials <cluster-name >
196
- --zone <cluster-zone >` . Also ensure you run ` gcloud auth configure-docker`
197
- so that ` docker-push ` works correctly.
198
- - To deploy to KIND, see below instead.
199
- - On other platforms... do whatever it is you're supposed to do (and update
200
- this documentation with more useful guidance!).
201
- - Use ` make deploy ` to deploy to your cluster.
202
- - This will also install the ` kubectl-hns ` plugin into ` $GOPATH/bin ` . Ensure
203
- that this is in your ` PATH ` env var if you want to use it by saying `kubectl
204
- hns`, as described in the user guide.
205
- - The manifests that get deployed will be output to
206
- ` /manifests/hnc-controller.yaml ` if you want to see exactly what gets
207
- deployed.
208
- - Note that ` make deploy ` can respond to env vars in your environment; see
209
- the Makefile for more information.
210
- - To view logs, say ` make deploy-watch `
211
-
212
- #### Special considerations for developing with KIND
213
-
214
- While developing the HNC, it's usually faster to deploy locally to
215
- [ KIND] ( https://kind.sigs.k8s.io ) . But be aware of the following gotchas:
216
-
217
- * When you install KIND, make sure you're _ not_ in the HNC directory, otherwise
218
- all kinds of Go module stuff will get messed up (this is a general KIND
219
- issue).
220
- * Instead of ` make deploy ` , say ` make kind-deploy ` (or, equivalently,
221
- ` CONFIG=kind make deploy ` or ` make deploy CONFIG=kind ` ). This bypasses the
222
- steps where you try to push the image to a Docker registry like Docker Hub or
223
- GCP Container Registry (` gcr.io ` ).
224
- * It's up to you to ensure that your kubectl context is pointed to your KIND
225
- cluster (use ` kubectl config get-contexts ` to see if it is).
226
- * Run ` make kind-reset ` to stop any existing KIND cluster and setup a new one.
227
- You don't need to run this every time, only when you're first starting
228
- development or you think your KIND cluster is in a bad state.
229
-
230
- In addition, KIND doesn't integrate with any identity providers - that is, you
231
- can't add "
[email protected] " as a "regular user." So you'll have to use service
232
- accounts and impersonate them to test things like RBAC rules. Use `kubectl --as
233
- system:serviceaccount:<namespace >:<sa-name >` to impersonate a service account
234
- from the command line, [ as documented
235
- here] ( https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-subjects ) .
236
-
237
- I * think* you can also use client certificate requests but I haven't tried that
238
- out. If you don't know what I'm talking about, you probably don't want to try it
239
- out either. If you do, please update these docs when you get the chance!j
240
-
241
- #### Testing changes without a test cluster
242
-
243
- Alternatively, you can also run the controller locally (ie, not on the cluster)
244
- by saying ` make run ` . You still need _ a_ cluster to exist (and your kubeconfig
245
- must be pointing to it) but it's sometimes nice to have everything running on
246
- your machine - e.g., if you want to run a debugger.
247
-
248
- Webhooks don't work in this mode because I haven't bothered to find an easy way
249
- to make them work yet. We don't really use this method ourselves anymore so it
250
- may not always work.
251
-
252
- ### Code structure
253
-
254
- The directory structure is fairly standard for a Kubernetes project. The most
255
- interesting directories are probably:
256
-
257
- * ` /api ` : the API definition.
258
- * ` /cmd ` : top-level executables. Currently the manager and the kubectl plugin.
259
- * ` /hack ` : various release scripts, end-to-end bash script tests and other
260
- miscellaneous files.
261
- * ` /internal/reconcilers ` : the reconcilers and their tests
262
- * ` /internal/validators ` : validating admission controllers
263
- * ` /internal/forest ` : the in-memory data structure, shared between the reconcilers
264
- and validators
265
- * ` /internal/kubectl ` : implementation of the ` kubectl-hns ` plugin
266
- * ` /test ` : various end-to-end tests
267
-
268
- Within the ` reconcilers ` directory, there are four reconcilers:
269
-
270
- * ** HNCConfiguration reconciler:** manages the HNCConfiguration via the
271
- cluster-wide ` config ` singleton.
272
- * ** Anchor reconciler:** manages the subnamespace anchors via
273
- the ` subnamespaceanchor ` resources.
274
- * ** HierarchyConfiguration reconciler:** manages the hierarchy and the
275
- namespaces via the ` hierarchy ` singleton per namespace.
276
- * ** Object reconciler:** propagates (copies and deletes) the relevant objects
277
- from parents to children. Instantiated once for every supported object GVK
278
- (group/version/kind) - e.g., ` Role ` , ` Secret ` , etc.
279
-
280
- ### CI infrastructure
90
+ ## CI infrastructure and release
281
91
282
92
HNC uses Prow to run tests, which is configured
283
93
[ here] ( https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/wg-multi-tenancy ) .
@@ -292,6 +102,4 @@ For more information about Prow jobs (e.g. a reference for the configs), see
292
102
These config files should be inspected periodically (e.g. about once a release)
293
103
to make sure they're fully up-to-date.
294
104
295
- ### Releasing
296
-
297
105
To release HNC, follow [ this guide] ( docs/releasing.md ) .
0 commit comments