Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions cmd/nelm/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,6 @@ func AddResourceValidationFlags(cmd *cobra.Command, cfg *common.ResourceValidati
return fmt.Errorf("add flag: %w", err)
}

if err := cli.AddFlag(cmd, &cfg.LocalResourceValidation, "local-resource-validation", false, "Do not use external json schema sources, validate against the json schemas embedded into the binary instead", cli.AddFlagOptions{
GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes,
Group: resourceValidationGroup,
}); err != nil {
return fmt.Errorf("add flag: %w", err)
}

if err := cli.AddFlag(cmd, &cfg.ValidationSkip, "resource-validation-skip", []string{}, "Skip resource validation for resources with specified attributes. Format: key1=value1,key2=value2. Supported keys: group, version, kind, name, namespace. Example: kind=Deployment,name=my-app", cli.AddFlagOptions{
GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes,
Group: resourceValidationGroup,
Expand Down
16 changes: 0 additions & 16 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ nelm release install [options...] -n namespace -r release [chart-dir|chart-repo-

**Resource validation options:**

- `--local-resource-validation` (default: `false`)

Do not use external json schema sources, validate against the json schemas embedded into the binary instead\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_INSTALL\_LOCAL\_RESOURCE\_VALIDATION

- `--no-resource-validation` (default: `false`)

Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_INSTALL\_NO\_RESOURCE\_VALIDATION
Expand Down Expand Up @@ -621,10 +617,6 @@ nelm release rollback [options...] -n namespace -r release [revision]

**Resource validation options:**

- `--local-resource-validation` (default: `false`)

Do not use external json schema sources, validate against the json schemas embedded into the binary instead\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_ROLLBACK\_LOCAL\_RESOURCE\_VALIDATION

- `--no-resource-validation` (default: `false`)

Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_ROLLBACK\_NO\_RESOURCE\_VALIDATION
Expand Down Expand Up @@ -990,10 +982,6 @@ nelm release plan install [options...] -n namespace -r release [chart-dir|chart-

**Resource validation options:**

- `--local-resource-validation` (default: `false`)

Do not use external json schema sources, validate against the json schemas embedded into the binary instead\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_LOCAL\_RESOURCE\_VALIDATION

- `--no-resource-validation` (default: `false`)

Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_RELEASE\_PLAN\_INSTALL\_NO\_RESOURCE\_VALIDATION
Expand Down Expand Up @@ -2159,10 +2147,6 @@ nelm chart lint [options...] [chart-dir|chart-repo-name/chart-name|chart-archive

**Resource validation options:**

- `--local-resource-validation` (default: `false`)

Do not use external json schema sources, validate against the json schemas embedded into the binary instead\. Vars: \$NELM\_LOCAL\_RESOURCE\_VALIDATION, \$NELM\_CHART\_LINT\_LOCAL\_RESOURCE\_VALIDATION

- `--no-resource-validation` (default: `false`)

Disable resource validation\. Vars: \$NELM\_NO\_RESOURCE\_VALIDATION, \$NELM\_CHART\_LINT\_NO\_RESOURCE\_VALIDATION
Expand Down
2 changes: 0 additions & 2 deletions pkg/common/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ type ResourceValidationOptions struct {
NoResourceValidation bool `json:"noResourceValidation"`
// NoValuesSchemaValidation disables values validation against json schema.
NoValuesSchemaValidation bool `json:"noValuesSchemaValidation"`
// LocalResourceValidation validates by using kubeconform embedded schemas and client-go codec only.
LocalResourceValidation bool `json:"localResourceValidation"`
// ValidationSkip Do not validate resources with specific attributes.
ValidationSkip []string `json:"validationSkip"`
// ValidationSchemaCacheLifetime how long the schema cache should be valid.
Expand Down
6 changes: 1 addition & 5 deletions pkg/resource/kubeconform.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type kubeConformValidator struct {
validators []*kubeConformInstance
}

func newKubeConformValidator(schemaCacheLifetime time.Duration, schemaSources []string, embeddedSchemasOnly bool) (*kubeConformValidator, error) {
func newKubeConformValidator(schemaCacheLifetime time.Duration, schemaSources []string) (*kubeConformValidator, error) {
kubernetesSource, err := schemas.KubernetesSource()
if err != nil {
return nil, fmt.Errorf("get embedded Kubernetes schemas: %w", err)
Expand All @@ -55,10 +55,6 @@ func newKubeConformValidator(schemaCacheLifetime time.Duration, schemaSources []
return nil, fmt.Errorf("get embedded CRD schemas: %w", err)
}

if embeddedSchemasOnly {
schemaSources = nil
}

cacheSubDirName := getHash(strings.Join(schemaSources, "-"))

sources := slices.Clone(schemaSources)
Expand Down
2 changes: 1 addition & 1 deletion pkg/resource/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func validateResourceSchemas(ctx context.Context, releaseNamespace string, resou
kubeConformValidator, err := newKubeConformValidator(
opts.ValidationSchemaCacheLifetime,
opts.ValidationExtraSchemas,
opts.LocalResourceValidation)
)
if err != nil {
return fmt.Errorf("get schema validator: %w", err)
}
Expand Down