Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly committed May 28, 2023
1 parent de4b161 commit a811c0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/openapiclient/local_crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (k *localCRDsClient) Paths() (map[string]openapi.GroupVersion, error) {
}
sch.AddExtension("x-kubernetes-group-version-kind", []interface{}{gvkObj})
// Add schema extension to propagate the scope
sch.AddExtension("x-kubectl-validate-scope", strings.ToLower(string(crd.Spec.Scope)))
sch.AddExtension("x-kubectl-validate-scope", string(crd.Spec.Scope))
key := fmt.Sprintf("%s/%s.%s", gvk.Group, gvk.Version, gvk.Kind)
if existing, exists := crds[gvk.GroupVersion()]; exists {
existing.Components.Schemas[key] = sch
Expand Down
2 changes: 1 addition & 1 deletion pkg/validatorfactory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (s *ValidatorFactory) ValidatorsForGVK(gvk schema.GroupVersionKind) (*Valid
nsScoped := namespaced.Has(gvk)
// Check schema extensions to see if the scope was manually added
if scope, ok := def.Extensions.GetString("x-kubectl-validate-scope"); ok {
nsScoped = scope == strings.ToLower(string(apiextensions.NamespaceScoped))
nsScoped = strings.ToLower(scope) == strings.ToLower(string(apiextensions.NamespaceScoped))

Check failure on line 376 in pkg/validatorfactory/factory.go

View workflow job for this annotation

GitHub Actions / golangci-lint

SA6005: should use strings.EqualFold instead (staticcheck)
}

val := newValidatorEntry(nam, nsScoped, def, ssf)
Expand Down

0 comments on commit a811c0e

Please sign in to comment.