mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
chore: enable misspell linter (#3932)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
d7a3ba596d
commit
52cc493e57
4 changed files with 8 additions and 7 deletions
|
@ -18,6 +18,7 @@ linters:
|
||||||
- govet
|
- govet
|
||||||
- importas
|
- importas
|
||||||
- ineffassign
|
- ineffassign
|
||||||
|
- misspell
|
||||||
- noctx
|
- noctx
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
- structcheck
|
||||||
|
|
|
@ -295,7 +295,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k
|
||||||
reasonsForFailure = append(reasonsForFailure, fmt.Errorf("no resource matched"))
|
reasonsForFailure = append(reasonsForFailure, fmt.Errorf("no resource matched"))
|
||||||
}
|
}
|
||||||
} else if len(rule.MatchResources.All) > 0 {
|
} else if len(rule.MatchResources.All) > 0 {
|
||||||
// include object if ALL of the criterias match
|
// include object if ALL of the criteria match
|
||||||
for _, rmr := range rule.MatchResources.All {
|
for _, rmr := range rule.MatchResources.All {
|
||||||
reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionMatchHelper(rmr, admissionInfo, resource, dynamicConfig, namespaceLabels)...)
|
reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionMatchHelper(rmr, admissionInfo, resource, dynamicConfig, namespaceLabels)...)
|
||||||
}
|
}
|
||||||
|
@ -305,12 +305,12 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(rule.ExcludeResources.Any) > 0 {
|
if len(rule.ExcludeResources.Any) > 0 {
|
||||||
// exclude the object if ANY of the criterias match
|
// exclude the object if ANY of the criteria match
|
||||||
for _, rer := range rule.ExcludeResources.Any {
|
for _, rer := range rule.ExcludeResources.Any {
|
||||||
reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionExcludeHelper(rer, admissionInfo, resource, dynamicConfig, namespaceLabels)...)
|
reasonsForFailure = append(reasonsForFailure, matchesResourceDescriptionExcludeHelper(rer, admissionInfo, resource, dynamicConfig, namespaceLabels)...)
|
||||||
}
|
}
|
||||||
} else if len(rule.ExcludeResources.All) > 0 {
|
} else if len(rule.ExcludeResources.All) > 0 {
|
||||||
// exlcude the object if ALL the criterias match
|
// exclude the object if ALL the criteria match
|
||||||
excludedByAll := true
|
excludedByAll := true
|
||||||
for _, rer := range rule.ExcludeResources.All {
|
for _, rer := range rule.ExcludeResources.All {
|
||||||
// we got no errors inplying a resource did NOT exclude it
|
// we got no errors inplying a resource did NOT exclude it
|
||||||
|
@ -321,7 +321,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if excludedByAll {
|
if excludedByAll {
|
||||||
reasonsForFailure = append(reasonsForFailure, fmt.Errorf("resource excluded since the combination of all criterias exclude it"))
|
reasonsForFailure = append(reasonsForFailure, fmt.Errorf("resource excluded since the combination of all criteria exclude it"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rer := kyverno.ResourceFilter{UserInfo: rule.ExcludeResources.UserInfo, ResourceDescription: rule.ExcludeResources.ResourceDescription}
|
rer := kyverno.ResourceFilter{UserInfo: rule.ExcludeResources.UserInfo, ResourceDescription: rule.ExcludeResources.ResourceDescription}
|
||||||
|
@ -368,7 +368,7 @@ func matchesResourceDescriptionExcludeHelper(rer kyverno.ResourceFilter, admissi
|
||||||
excludeErrs := doesResourceMatchConditionBlock(rer.ResourceDescription, rer.UserInfo, admissionInfo, resource, dynamicConfig, namespaceLabels)
|
excludeErrs := doesResourceMatchConditionBlock(rer.ResourceDescription, rer.UserInfo, admissionInfo, resource, dynamicConfig, namespaceLabels)
|
||||||
// it was a match so we want to exclude it
|
// it was a match so we want to exclude it
|
||||||
if len(excludeErrs) == 0 {
|
if len(excludeErrs) == 0 {
|
||||||
errs = append(errs, fmt.Errorf("resource excluded since one of the criterias excluded it"))
|
errs = append(errs, fmt.Errorf("resource excluded since one of the criteria excluded it"))
|
||||||
errs = append(errs, excludeErrs...)
|
errs = append(errs, excludeErrs...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ type Controller struct {
|
||||||
kindToAPIVersions concurrentMap
|
kindToAPIVersions concurrentMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// apiVersions stores all available gvks for a kind, a gvk is "/" seperated string
|
// apiVersions stores all available gvks for a kind, a gvk is "/" separated string
|
||||||
type apiVersions struct {
|
type apiVersions struct {
|
||||||
serverPreferredGVK string
|
serverPreferredGVK string
|
||||||
gvks []string
|
gvks []string
|
||||||
|
|
|
@ -926,7 +926,7 @@ func validateImageRegistry(entry kyverno.ContextEntry) error {
|
||||||
// Replace all variables to prevent validation failing on variable keys.
|
// Replace all variables to prevent validation failing on variable keys.
|
||||||
ref := variables.ReplaceAllVars(entry.ImageRegistry.Reference, func(s string) string { return "kyvernoimageref" })
|
ref := variables.ReplaceAllVars(entry.ImageRegistry.Reference, func(s string) string { return "kyvernoimageref" })
|
||||||
|
|
||||||
// it's no use validating a refernce that contains a variable
|
// it's no use validating a reference that contains a variable
|
||||||
if !strings.Contains(ref, "kyvernoimageref") {
|
if !strings.Contains(ref, "kyvernoimageref") {
|
||||||
_, err := reference.Parse(ref)
|
_, err := reference.Parse(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue