Commit Graph

229 Commits

Author SHA1 Message Date
Chad Roberts dfd30a4901
[main/2.10.2] Add resource request and limit validation when creating a namespace (#550)
* Add resource request and limit validation when creating a namespace

* Update test for number of namespace admitters

* cleaning up lint errors

* Allow for empty resource limit annotation to be present

* Update to allow for partial request/limits
2024-12-06 15:23:31 -08:00
Jonathan Crowther 12879d9718
[0.7] Remove references to Restricted Admin (#549)
* Remove references to Restricted Admin

* Forgot to save one of the changes
2024-11-26 11:06:59 -05:00
Jonathan Crowther 80672e48bc
[0.6] Revert backing namespace changes (#539)
* Revert "[0.6] Make sure to update the name in the mutator (#535)"

This reverts commit 7e0627b265.

* Revert "[v0.6] Populate backing namespace field for projects (#532)"

This reverts commit b17444735b.
2024-11-05 09:54:39 -05:00
Jonathan Crowther 7e0627b265
[0.6] Make sure to update the name in the mutator (#535)
* Make sure to update the name in the mutator

* add unit test
2024-10-31 12:33:34 -04:00
Jonathan Crowther b17444735b
[v0.6] Populate backing namespace field for projects (#532)
* Populate backing namespace field for projects

* Address comments
2024-10-30 13:41:38 -04:00
Eric Promislow d09d706d1d
Bump to k8s 1.31 (#528)
* Merge pull request #316 from thatmidwesterncoder/toleration_validation (#459)

Add validation to Toleration and Affinitys Keys

* Bump to k8s 1.31

* Bump the maximum supported k8s version to 1.31

* Bump other k8s modules to be consistent with k8s 1.31

* Bump to versions of lasso and wrangler that support k8s 1.31

* Move go the go-uber gomock module.

* Update the wrangler module.

* Correct the mockgen install command.

* And re-correct the 'go install ... mockgen' command.

---------

Co-authored-by: Jacob Lindgren <jacob.lindgren@suse.com>
2024-10-28 17:18:11 -07:00
Jacob Lindgren 42b3f0d471
Merge pull request #316 from thatmidwesterncoder/toleration_validation (#459)
Add validation to Toleration and Affinitys Keys
2024-10-24 15:27:09 -05:00
Peter Matseykanets 8d0a593fa7
Use Namespaced scope for ClusterAuthToken validator (#522)
Ref: https://github.com/rancher/rancher/issues/45732
2024-10-16 14:49:45 -04:00
Peter Matseykanets 7faaa6262b
Validate LastUsedAt for Token and ClusterAuthToken (#520)
Ref: https://github.com/rancher/rancher/issues/45732
2024-10-09 09:36:46 -04:00
Jonathan Crowther be481b7632
Add checks for annotation to opt out of cluster owner RBAC (#511)
* Move common annotations to resources/common

* Add new annotation to opt out of creatorID

* Add comments and unit tests

* Fix integration test

* Update annotation name

* Add annotation check to project and cluster

* Move annotation check to create

* Fix unit tests
2024-10-04 10:18:01 -04:00
Kinara Shah 0f454e7031
Prevent dropping unknown cluster fields (#515)
* Prevents dropping unknown cluster fields

Signed-off-by: Dharmit Shah <dharmit.shah@suse.com>

* add test for v3 cluster mutator & add rke to replace in go.mod

adding rke to replace section will avoid pulling in rc versions
when updating pkg/apis in webhook
2024-10-03 13:24:14 -07:00
Peter Matseykanets 6b74a9a900
Validate creatorId and creator-principal-name annotations for cluster/project (#501)
Ref: https://github.com/rancher/rancher/issues/46828
2024-09-19 15:40:04 -04:00
Eric Promislow 0ca113673c
Display error output from dynamiclistener.Server (#494) 2024-09-09 15:28:22 -07:00
Peter Matseykanets 46f1698b49
Check that {disable|delete}-inactive-user-after setting is not less than auth-user-session-ttl-minutes (#471)
Ref: https://github.com/rancher/rancher/issues/46648
2024-09-09 15:24:39 -04:00
Eric Promislow f4ed164ced
Drop the direct dependency on rke/types. (#491)
* Drop the direct dependency on rke/types.

* Bump rancher/pkg/apis.

This means the module imports ancher/rke v1.6.0 from v1.6.0-rc10.
Without the pkg/apis bump 'go mod tidy' would regress to rke v1.6.0-rc9

* Pull in instance of rancher/pkg/apis from main.
2024-09-05 12:18:21 -07:00
Jake Hyde b4e54349f0
Update provisioning cluster docs 2024-08-20 11:57:13 -04:00
Jake Hyde 0256fa138a
Add validation to data directories on creation 2024-08-20 11:57:10 -04:00
Sakala Venkata Krishna Rohit 40e8eae329
Add validation for ClusterRepo (#470)
* Add clusterrepo validations

* Add docs

* unit tests
2024-08-12 14:03:54 -04:00
Eric Promislow 750b954a69 Stop testing the 'ok' part of a map access.
Verify that the actual value of the annotation is string "true"
when checking that it's ok to change the tls-mode from `system-store` to `strict`.
2024-08-05 13:42:27 -05:00
Peter Matseykanets ae4cc3b8a2
[main] Use the proper config when fetching mutating webhook configuration (#460)
Forwardport of #451
2024-08-03 17:14:30 -04:00
Peter Matseykanets e732dfd16d
[v0.5] Set FailurePolicy to Ignore for settings validator (#446)
* Set FailurePolicy to Ignore for settings validator
* Add unit and integration tests

Ref: https://github.com/rancher/rancher/issues/45841
2024-08-01 15:38:22 -04:00
Max Sokolovsky 5fa648def0
Add a check for the agent-tls-mode setting (#416) 2024-07-05 13:02:42 -04:00
Jake Hyde 70f1273ce3
Data dir rfc (#410)
Add validator for data directories
2024-07-01 19:20:11 -04:00
Jake Hyde 276b2b9534
Dynamic schema rfc (#368)
Add support for allow-dynamic-schema-drop annotation
2024-06-28 20:01:06 -04:00
Tom Lebreux 97679b88dd
Add k8s 1.30 support (#412) 2024-06-28 09:23:25 -04:00
Raul Cabello Martin bb709831c2
Remove external-rules feature flag (#414) 2024-06-25 16:10:16 +02:00
Raul Cabello Martin f5cfd9821f
[v0.5] s4: Fixes 374 (#409)
* Verify ExternalRules in RoleTemplates

If the feature flag external-rules is enabled, the validation for RT follows this sequence:
- 1) Reject if externalRules are provided and the user doesn’t have escalate permissions on RoleTemplates.
- 2) Validate the policy rules defined in externalRules the same way as the already existing rules field. This validation leverages Kubernetes’ upstream validation. Webhook will validate this only if external is set to true.
- 3) Use externalRules for resolving rules if provided.
- 4) Use backing ClusterRole in the local cluster if externalRules are not provided.
- 5) Reject if externalRules are not provided and there is no backing ClusterRole in the local cluster.

For PRTB or CRTB:
- 1) Use externalRules for resolving rules if provided.
- 2) Use backing ClusterRole in the local cluster if externalRules are not provided.

The previous verification process applies if the external-rules feature flag is disabled.

* Allow Restricted Admin to update external-rules feature flag (#102)

---------
Co-authored-by: Raul Cabello Martin <raulcabm@gmail.com>
Co-authored-by: Jonathan Crowther <jonathan.crowther@suse.com>

* bump rancher to be able to use ExternalRules

* fix test conflict

---------

Co-authored-by: Peter Matseykanets <peter.matseykanets@suse.com>
2024-06-25 10:34:38 +02:00
Raul Cabello Martin af2d8bd5d2
Fleet RBAC - InheritedFleetWorkspacePermissions validation (#348)
- Validate the user have enough permission to create/update the rules defined in InheritedFleetWorkspacePermissions.ResourceRules
- Validate the user have enough permission to create/update the rules that are generated based on the InheritedFleetWorkspacePermissions.WorkspaceVerbs

---------

Co-authored-by: Michael Bolot <michael.bolot@suse.com>
2024-06-24 09:49:31 +02:00
Eric Promislow 236a12fabc
Bump to k8s 1.29 (#366)
* Bump to k8s modules v0.29.3 (for k8s 1.29)

* Remove local replacement module.

* Bump to a rancher/rancher commit that has k8s 1.29 support

* Back out rancher 2.9 change that breaks drone integration tests.

* Remove the minimum k8s version from this chart.

* No need to use an older rancher image.
2024-06-20 14:36:17 -04:00
Peter Matseykanets b3bccd2707
[v0.5] s4: Fixes 227 (#404)
* Validate user retention userattribute fields and settings (#90)
* [v0.4.s4] Don't allow empty lastLogin user attribute (#97)
2024-06-18 07:26:38 -04:00
Chad Roberts 8e3d96998f
Add validator for clusterproxyconfigs to make sure only one is ever created for a given cluster (#327)
* Add validator for clusterproxyconfigs to make sure only one is ever created for a given cluster
* Add integration test for clusterProxyConfigs
2024-04-03 12:02:30 -04:00
Tom Lebreux c446d76682
Revert "Grant inherited permissions to other users" (#347) 2024-04-03 11:34:54 -04:00
Vatsal Parekh 9d7db6b376 Typo fix
Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
2024-04-01 17:52:21 +05:30
Vatsal Parekh 40556337bc Correct validating logic
Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
2024-04-01 17:52:21 +05:30
Vatsal Parekh 89f65970b4 Update docs for cluster context
Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
2024-04-01 17:52:21 +05:30
Vatsal Parekh 2148872946 Add unit test
Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
2024-04-01 17:52:21 +05:30
Vatsal Parekh 5493772417 Add validation to not admit RoleTemplates with both context=cluster & ProjectCreatorDefault=true
Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
2024-04-01 17:52:21 +05:30
Tom Lebreux 49160dee86
Add support for k8s 1.28 (#341) 2024-03-27 16:56:34 -04:00
Jonathan Crowther 8fe5a897de
Upgrade golangci-lint and fix all warnings/errors (#346) 2024-03-27 16:42:40 -04:00
Tom Lebreux 128b387a3c
Remove CAPI webhook (#338) 2024-03-19 13:24:29 -04:00
Tom Lebreux e0d3de431b Validate RoleTemplate as non-namespaced 2024-02-15 16:12:13 -05:00
Max Sokolovsky 75e382d09c
Merge pull request #326 from maxsokolovsky/2.9-validate-container-default-resource-limit
Validate container default resource limit on projects
2024-02-13 09:33:52 -05:00
Max Sokolovsky 41ae77d524 Validate container default resource limit on projects 2024-02-12 14:24:54 -05:00
Andreas Kupries 9884b4f045 address comment: drop superfluous CheckForVerbs
note: drop/inline `validateFields`
fix: fields paths reported for globalroles
2024-01-30 10:36:07 +01:00
Andreas Kupries 1d29e934e6 address comment: simplify ValidateRules 2024-01-30 10:27:13 +01:00
Andreas Kupries d7910fe65c address comment: simplify unit tests, drop dependency on exact error message 2024-01-30 10:26:31 +01:00
Andreas Kupries aa922f09d0 chore: updated roletemplae, globalrole documentation
chore: regenerated main documentation file
2024-01-29 13:22:36 +01:00
Andreas Kupries c26d327d39 fix: added proper rule validation to roletemplate
note: possible superfluousness of CheckForVerbs
2024-01-29 12:54:55 +01:00
Andreas Kupries a13fbcb2aa refactor: moved globalrole.validateRules to common.ValidateRules
fix: extended field path with proper index information for validated rule
chore: created unit tests for ValidateRules
2024-01-29 12:54:28 +01:00
Tom Lebreux 9392f57ca1 Evaluate Rules from external RT with project context
This fixes a bug where a project owner is not able to give some
privileges that they have because those aren't accounted for in the
webhook.
2024-01-16 13:05:39 -05:00