mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
config: remove deprecated upgradeConfig and require name and microserviceVersion fields (#1541)
* Remove deprecated fields * Remove warning for not setting attestationVariant * Dont write attestationVariant to config --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
aed9b8d5f5
commit
62c165750f
7 changed files with 11 additions and 112 deletions
|
@ -426,20 +426,6 @@ func returnsTrue(_ validator.FieldLevel) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// validateUpgradeConfig prints a warning to STDERR and validates the field successfully.
|
||||
func validateUpgradeConfig(sl validator.StructLevel) {
|
||||
config, ok := sl.Current().Interface().(UpgradeConfig)
|
||||
if !ok {
|
||||
sl.ReportError(config, "upgrade", "UpgradeConfig", "malformed_upgrade_config", "")
|
||||
}
|
||||
// A valid `upgrade` section will always have a non-nil Measurements map.
|
||||
// Only print a warning if the user actually specified an upgrade section.
|
||||
if config.Image == "" && config.CSP == cloudprovider.Unknown && config.Measurements == nil {
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(os.Stderr, "WARNING: the config key `upgrade` will be deprecated in an upcoming version. Please check the documentation for more information.")
|
||||
}
|
||||
|
||||
func registerValidateNameError(ut ut.Translator) error {
|
||||
return ut.Add("validate_name", "{0} must be no more than {1} characters long", true)
|
||||
}
|
||||
|
@ -459,12 +445,6 @@ func (c *Config) translateValidateNameError(ut ut.Translator, fe validator.Field
|
|||
// Since this value may differ between providers, we can't simply use built-in validation.
|
||||
// This also allows us to eventually add more validation rules for constellation names if necessary.
|
||||
func (c *Config) validateName(fl validator.FieldLevel) bool {
|
||||
// TODO: v2.7: remove fallback to defaultName and make name a required field
|
||||
if c.Name == "" {
|
||||
fmt.Fprintln(os.Stderr, "WARNING: the config key `name` is not set. This key will be required in the next version. Falling back to default name.")
|
||||
c.Name = defaultName
|
||||
}
|
||||
|
||||
if c.Provider.AWS != nil {
|
||||
return len(fl.Field().String()) <= constants.AWSConstellationNameLength
|
||||
}
|
||||
|
@ -482,7 +462,8 @@ func (c *Config) translateValidAttestVariantError(ut ut.Translator, _ validator.
|
|||
}
|
||||
|
||||
func (c *Config) validAttestVariant(_ validator.FieldLevel) bool {
|
||||
// TODO: v2.8: remove variant fallback and make variant a required field
|
||||
// TODO(AB#3040): function will be obsolete in v2.8
|
||||
// attestationVariant will be refactored into a required struct
|
||||
c.addMissingVariant()
|
||||
|
||||
attestationVariant, err := variant.FromString(c.AttestationVariant)
|
||||
|
@ -512,8 +493,6 @@ func (c *Config) addMissingVariant() {
|
|||
if c.AttestationVariant != "" {
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(os.Stderr, "WARNING: the config key `attestationVariant` is not set. This key will be required in the next version.")
|
||||
|
||||
switch c.GetProvider() {
|
||||
case cloudprovider.AWS:
|
||||
c.AttestationVariant = variant.AWSNitroTPM{}.String()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue