From ff4b5db74c25d6fc1615122e1aedae1bca9c6609 Mon Sep 17 00:00:00 2001 From: Otto Bittner Date: Wed, 12 Jul 2023 15:08:37 +0200 Subject: [PATCH] config: make deployCSIDriver backwards compatible (#2088) We added the field in 2.9 but can only require it in 2.10. --- internal/config/config.go | 14 +++++++++----- internal/config/config_doc.go | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 001b77113..ba108596b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -130,7 +130,7 @@ type AWSConfig struct { IAMProfileWorkerNodes string `yaml:"iamProfileWorkerNodes" validate:"required"` // description: | // Deploy Persistent Disk CSI driver with on-node encryption. For details see: https://docs.edgeless.systems/constellation/architecture/encrypted-storage - DeployCSIDriver *bool `yaml:"deployCSIDriver" validate:"required"` + DeployCSIDriver *bool `yaml:"deployCSIDriver"` // TODO (msanft): after v2.9 release re-enable "required" validation } // AzureConfig are Azure specific configuration values used by the CLI. @@ -452,10 +452,14 @@ func New(fileHandler file.Handler, name string, fetcher attestationconfigapi.Fet c.Provider.OpenStack.Password = openstackPassword } - // Backwards compatibility: configs without the field `microserviceVersion` are valid in version 2.6. - // In case the field is not set in an old config we prefill it with the default value. - if c.MicroserviceVersion == "" { - c.MicroserviceVersion = Default().MicroserviceVersion + // Backwards compatibility: configs without the field `deployCSIDriver` are valid in version 2.8. + // TODO (msanft): v2.9. Remove after v2.9 release. + if c.Provider.AWS != nil && c.Provider.AWS.DeployCSIDriver == nil { + fmt.Fprintln( + os.Stderr, + "WARNING: 'provider.aws.deployCSIDriver' not set. The key will be required in v2.10. Defaulting to 'false'.", + ) + c.Provider.AWS.DeployCSIDriver = toPtr(false) } return c, c.Validate(force) diff --git a/internal/config/config_doc.go b/internal/config/config_doc.go index 5b22e5a8b..3ba66314f 100644 --- a/internal/config/config_doc.go +++ b/internal/config/config_doc.go @@ -159,7 +159,7 @@ func init() { AWSConfigDoc.Fields[5].Comments[encoder.LineComment] = "Name of the IAM profile to use for the worker nodes." AWSConfigDoc.Fields[6].Name = "deployCSIDriver" AWSConfigDoc.Fields[6].Type = "bool" - AWSConfigDoc.Fields[6].Note = "" + AWSConfigDoc.Fields[6].Note = "TODO (msanft): after v2.9 release re-enable \"required\" validation\n" AWSConfigDoc.Fields[6].Description = "Deploy Persistent Disk CSI driver with on-node encryption. For details see: https://docs.edgeless.systems/constellation/architecture/encrypted-storage" AWSConfigDoc.Fields[6].Comments[encoder.LineComment] = "Deploy Persistent Disk CSI driver with on-node encryption. For details see: https://docs.edgeless.systems/constellation/architecture/encrypted-storage"