Commit 543f099
✨ Check known required permissions for install before installing with the helm applier (#1858)
* permissions preflight: copy necessary kubernetes libs
Signed-off-by: Joe Lanford <[email protected]>
* permissions preflight: kubernetes rbac code modifications
Signed-off-by: Joe Lanford <[email protected]>
* permissions preflight: add preauth implementation
Signed-off-by: Joe Lanford <[email protected]>
* permissions preflight: enable implementation behind feature gate
Signed-off-by: Joe Lanford <[email protected]>
* Rm k8s.io/kubernetes copypasta & import/replace
This is the manual version. Needed to change rbac.go a bit to allow for v1.32.2 code changes, but basically as-was
Signed-off-by: Brett Tofel <[email protected]>
* Adds k8s.io/ lib maintainer tool
go.mod made in the current form the tool generates
Signed-off-by: Brett Tofel <[email protected]>
* Make debug a flag
Signed-off-by: Brett Tofel <[email protected]>
* Small fix, fixes err on kubernetes replace itself
Signed-off-by: Brett Tofel <[email protected]>
* Changes to allow calling as make target
Signed-off-by: Brett Tofel <[email protected]>
* Run go mod tidy post rebase
Signed-off-by: Brett Tofel <[email protected]>
* From rebase - add PreAuthorizer to Helm struct
Signed-off-by: Brett Tofel <[email protected]>
* Fixes to pass linter
Signed-off-by: Brett Tofel <[email protected]>
* Add needed setups to preflightPerm unit tests
Signed-off-by: Brett Tofel <[email protected]>
* Address review comments on rbac.go
rbac_test.go likely coming soon
Signed-off-by: Brett Tofel <[email protected]>
* Add tests for authorization/rbac.go
Signed-off-by: Tayler Geiger <[email protected]>
* Move k8sMaintainer code to its own dir
Signed-off-by: Brett Tofel <[email protected]>
* Run k8smaintainer code post rebase
Signed-off-by: Brett Tofel <[email protected]>
* Lint acceptable format for rbac_test.go
Signed-off-by: Brett Tofel <[email protected]>
* Add tests for authorization/rbac.go
Signed-off-by: Tayler Geiger <[email protected]>
* Refactor inline feature gate check
Signed-off-by: Brett Tofel <[email protected]>
* Change PreAuthorize() return value to []ScopedPolicyRules
Use []ScopedPolicyRules struct for first return value in PreAuthorize()
to avoid issues with random iteration order in previous map return
value.
Signed-off-by: Tayler Geiger <[email protected]>
* Lint acceptable format for rbac_test.go (take 2)
Signed-off-by: Brett Tofel <[email protected]>
* Add fakeStorage dry run for escalationCheck
Signed-off-by: Brett Tofel <[email protected]>
* Revert "Add fakeStorage dry run for escalationCheck"
This reverts commit 2681194.
* Rename template func to renderClientOnlyRelease
Signed-off-by: Brett Tofel <[email protected]>
* Updated comment on returns of PreAuthorize
Signed-off-by: Brett Tofel <[email protected]>
* Remove repetition in rbac_test.go
Signed-off-by: Tayler Geiger <[email protected]>
* k8smaintainer stage repo version pin logic upgrade
Signed-off-by: Brett Tofel <[email protected]>
* Simplify PreAuthorizer handling via feature gate
Signed-off-by: Brett Tofel <[email protected]>
* Split pre-auth checks cluster-scoped & ns-scoped
Signed-off-by: Brett Tofel <[email protected]>
* Handle missing rules from escalation errors
Also sort final missing rules by namespace
Signed-off-by: Tayler Geiger <[email protected]>
* Clean up escalation error parsing and fix tests
Pass in the clusterextension to PreAuthorize instead of the user.Info
since we need the extension to create the clusterextension/finalizer
Signed-off-by: Tayler Geiger <[email protected]>
* Make tidy after rebase
Signed-off-by: Brett Tofel <[email protected]>
* GCI the files so lint passes
Signed-off-by: Brett Tofel <[email protected]>
* Use slices.SortFunc instead of sort.Slice
Signed-off-by: Tayler Geiger <[email protected]>
* Lift running pre-auth checks out of Helm Apply
Signed-off-by: Brett Tofel <[email protected]>
* Add centralized logging for feature gate status
Signed-off-by: Brett Tofel <[email protected]>
* Err msg reads better
Co-authored-by: Per Goncalves da Silva <[email protected]>
* Run make tidy after rebase
Signed-off-by: Brett Tofel <[email protected]>
* No more magic numbers
Signed-off-by: Brett Tofel <[email protected]>
* Sort components of missing rules lists
Signed-off-by: Brett Tofel <[email protected]>
* Streamline var usage
* Lift to escalationCheckerFor method
Signed-off-by: Brett Tofel <[email protected]>
* Fix lint prealloc err on allMissingPolicyRules
Signed-off-by: Brett Tofel <[email protected]>
* Prealloc missingRulesWithDeduplicatedVerbs
* Tidy verb vars together with comment & issue link
Signed-off-by: Brett Tofel <[email protected]>
* Add comments and protections on parsing err msg
Signed-off-by: Brett Tofel <[email protected]>
* Improvements to k8smaintainer code
Signed-off-by: Brett Tofel <[email protected]>
* Linter fix for unused byte slice
Signed-off-by: Brett Tofel <[email protected]>
* New target now 'k8s-pin', take ENVVAR for k8s ver
Also separate the target from make tiday and some code cleanup.
Signed-off-by: Brett Tofel <[email protected]>
* Replace x/mod/semver w/ blang - more legible parse
Signed-off-by: Brett Tofel <[email protected]>
* Move EXHELP for k8s-pin target
Signed-off-by: Brett Tofel <[email protected]>
* Update README.md to account for changes
Signed-off-by: Brett Tofel <[email protected]>
* Split permission & resolution error captures
Signed-off-by: Brett Tofel <[email protected]>
* Improve permission regexp matching
Now handles multiple values in any of APIGroups, Resources, or Verbs.
Adds small utility function for trimming and splitting those values into
a string slice.
Signed-off-by: Tayler Geiger <[email protected]>
* Run make k8s-pin post-rebase
Signed-off-by: Brett Tofel <[email protected]>
* Add tests to verify kubernetes API errors vs regex
Signed-off-by: Brett Tofel <[email protected]>
* permissions preflight: refactoring escalation error parser
Signed-off-by: Joe Lanford <[email protected]>
* permission preflight: emit error when encountering unknown policy rule field
Signed-off-by: Joe Lanford <[email protected]>
* permissions preflight: fixup escalation error parser and tests
Signed-off-by: Joe Lanford <[email protected]>
* permissions preflight: add kubernetes compatibility tests, other small fixups
Signed-off-by: Joe Lanford <[email protected]>
* preflight permissions: removing clusterextensions/finalizer patch requirement
The clusterextensions/finalizer requirement comes from the desire to
support clusters where OwnerReferencesPermissionEnforcement plugin is
enabled. This plugin requires "update", but not "patch" for the
clusterextensions/finalizers permission.
See: https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#ownerreferencespermissionenforcement
Signed-off-by: Joe Lanford <[email protected]>
* Addressing latest round of PR feedback
Signed-off-by: Tayler Geiger <[email protected]>
* Fix linting errors
Signed-off-by: Brett Tofel <[email protected]>
* SingleOwnNSInstallSupport feature gate reset
Signed-off-by: Brett Tofel <[email protected]>
* Fix feature gate logging unhashable hash problem
Signed-off-by: Tayler Geiger <[email protected]>
* Remove duplicate test case
Signed-off-by: Tayler Geiger <[email protected]>
---------
Signed-off-by: Joe Lanford <[email protected]>
Signed-off-by: Brett Tofel <[email protected]>
Signed-off-by: Tayler Geiger <[email protected]>
Co-authored-by: Joe Lanford <[email protected]>
Co-authored-by: Tayler Geiger <[email protected]>
Co-authored-by: Per Goncalves da Silva <[email protected]>1 parent 2092ee9 commit 543f099
File tree
14 files changed
+1985
-38
lines changed- cmd/operator-controller
- config/base/operator-controller/rbac
- hack/tools/k8smaintainer
- internal/operator-controller
- applier
- authorization
- controllers
- features
14 files changed
+1985
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | | - | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
200 | | - | |
201 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
202 | 211 | | |
203 | 212 | | |
204 | 213 | | |
| |||
403 | 412 | | |
404 | 413 | | |
405 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
406 | 422 | | |
407 | 423 | | |
408 | 424 | | |
409 | 425 | | |
| 426 | + | |
410 | 427 | | |
411 | 428 | | |
412 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
50 | 60 | | |
51 | 61 | | |
52 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
218 | | - | |
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
| |||
232 | 238 | | |
233 | 239 | | |
234 | 240 | | |
235 | | - | |
236 | | - | |
| 241 | + | |
| 242 | + | |
237 | 243 | | |
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
243 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
774 | | - | |
775 | | - | |
| 774 | + | |
| 775 | + | |
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
786 | 790 | | |
787 | 791 | | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
792 | 798 | | |
793 | 799 | | |
794 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments