Merge pull request #85800 from beautytiger/dev-191202-fixtrim
fix: replace TrimLeft with TrimPrefix and TrimRight with TrimSuffix Kubernetes-commit: 896b77ed5363259d9d3978664d61a98dc4bdf406
This commit is contained in:
		
						commit
						0e7fa4e989
					
				|  | @ -580,15 +580,15 @@ | |||
| 		}, | ||||
| 		{ | ||||
| 			"ImportPath": "k8s.io/apimachinery", | ||||
| 			"Rev": "03184f823e28" | ||||
| 			"Rev": "adc6f4cd9e7d" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"ImportPath": "k8s.io/client-go", | ||||
| 			"Rev": "e9644b2e3edc" | ||||
| 			"Rev": "bc9b51d240b2" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"ImportPath": "k8s.io/component-base", | ||||
| 			"Rev": "0d4d24e738e4" | ||||
| 			"Rev": "3ac1376c73aa" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"ImportPath": "k8s.io/gengo", | ||||
|  |  | |||
							
								
								
									
										12
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										12
									
								
								go.mod
								
								
								
								
							|  | @ -45,9 +45,9 @@ require ( | |||
| 	gopkg.in/yaml.v2 v2.2.4 | ||||
| 	gotest.tools v2.2.0+incompatible // indirect | ||||
| 	k8s.io/api v0.0.0-20191121015604-11707872ac1c | ||||
| 	k8s.io/apimachinery v0.0.0-20191128180518-03184f823e28 | ||||
| 	k8s.io/client-go v0.0.0-20191204082519-e9644b2e3edc | ||||
| 	k8s.io/component-base v0.0.0-20191204083903-0d4d24e738e4 | ||||
| 	k8s.io/apimachinery v0.0.0-20191203211716-adc6f4cd9e7d | ||||
| 	k8s.io/client-go v0.0.0-20191204082520-bc9b51d240b2 | ||||
| 	k8s.io/component-base v0.0.0-20191204083906-3ac1376c73aa | ||||
| 	k8s.io/klog v1.0.0 | ||||
| 	k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a | ||||
| 	k8s.io/utils v0.0.0-20191114184206-e782cd3c129f | ||||
|  | @ -59,7 +59,7 @@ replace ( | |||
| 	golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 | ||||
| 	golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 | ||||
| 	k8s.io/api => k8s.io/api v0.0.0-20191121015604-11707872ac1c | ||||
| 	k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191128180518-03184f823e28 | ||||
| 	k8s.io/client-go => k8s.io/client-go v0.0.0-20191204082519-e9644b2e3edc | ||||
| 	k8s.io/component-base => k8s.io/component-base v0.0.0-20191204083903-0d4d24e738e4 | ||||
| 	k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191203211716-adc6f4cd9e7d | ||||
| 	k8s.io/client-go => k8s.io/client-go v0.0.0-20191204082520-bc9b51d240b2 | ||||
| 	k8s.io/component-base => k8s.io/component-base v0.0.0-20191204083906-3ac1376c73aa | ||||
| ) | ||||
|  |  | |||
							
								
								
									
										6
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										6
									
								
								go.sum
								
								
								
								
							|  | @ -353,9 +353,9 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh | |||
| honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||
| honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||
| k8s.io/api v0.0.0-20191121015604-11707872ac1c/go.mod h1:R/s4gKT0V/cWEnbQa9taNRJNbWUK57/Dx6cPj6MD3A0= | ||||
| k8s.io/apimachinery v0.0.0-20191128180518-03184f823e28/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= | ||||
| k8s.io/client-go v0.0.0-20191204082519-e9644b2e3edc/go.mod h1:5lSG1yeDZVwDYAHe9VK48SCe5zmcnkAcf2Mx59TuhmM= | ||||
| k8s.io/component-base v0.0.0-20191204083903-0d4d24e738e4/go.mod h1:8VIh1jErItC4bg9hLBkPneyS77Tin8KwSzbYepHJnQI= | ||||
| k8s.io/apimachinery v0.0.0-20191203211716-adc6f4cd9e7d/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= | ||||
| k8s.io/client-go v0.0.0-20191204082520-bc9b51d240b2/go.mod h1:5lSG1yeDZVwDYAHe9VK48SCe5zmcnkAcf2Mx59TuhmM= | ||||
| k8s.io/component-base v0.0.0-20191204083906-3ac1376c73aa/go.mod h1:mECWvHCPhJudDVDMtBl+AIf/YnTMp5r1F947OYFUwP0= | ||||
| k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= | ||||
| k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= | ||||
| k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= | ||||
|  |  | |||
|  | @ -185,11 +185,11 @@ func ruleMatchesResource(r *audit.PolicyRule, attrs authorizer.Attributes) bool | |||
| 						return true | ||||
| 					} | ||||
| 					// match "*/subresource"
 | ||||
| 					if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimLeft(res, "*/") { | ||||
| 					if len(subresource) > 0 && strings.HasPrefix(res, "*/") && subresource == strings.TrimPrefix(res, "*/") { | ||||
| 						return true | ||||
| 					} | ||||
| 					// match "resource/*"
 | ||||
| 					if strings.HasSuffix(res, "/*") && resource == strings.TrimRight(res, "/*") { | ||||
| 					if strings.HasSuffix(res, "/*") && resource == strings.TrimSuffix(res, "/*") { | ||||
| 						return true | ||||
| 					} | ||||
| 				} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue