Skip to content

EncryptionConfig: use standard method for parsing config file #61599

@php-coder

Description

@php-coder

Is this a BUG REPORT or FEATURE REQUEST?:
/kind feature
/sig auth

What happened:
Currently encryption config parsing uses a non-standard parsing method that pays no attention to the version of the config:

var config EncryptionConfig
err = yaml.Unmarshal(configFileContents, &config)
if err != nil {
return nil, fmt.Errorf("error while parsing file: %v", err)
}
if config.Kind == "" {
return nil, fmt.Errorf("invalid configuration file, missing Kind")
}
if config.Kind != "EncryptionConfig" {
return nil, fmt.Errorf("invalid configuration kind %q provided", config.Kind)
}
// TODO config.APIVersion is unchecked

What you expected to happen:

  • the types must change to use standard methods for including kind/apiVersion (inlining metav1.TypeMeta like all other objects)
  • define a versioned config (we can promote straight to v1beta1 if we don't require any structural changes)
  • parsing must require well-formed config files

Anything else we need to know?:
Requested by @liggitt and extracted from #61592 (comment)

Steps to be done:

  • fix type definition to actually be a runtime object, inline TypeMeta, etc
  • define v1beta1 API types, generate conversions/defaults
  • define scheme/codecs that have the external (v1beta1) and internal (existing) types registered
  • use that scheme/codec to load the config (handles decoding the v1beta1 version, conversion to internal version)

CC @marrrvin

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.sig/authCategorizes an issue or PR as relevant to SIG Auth.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions