config: make deployCSIDriver backwards compatible (#2088)

We added the field in 2.9 but can only require it in 2.10.
This commit is contained in:
Otto Bittner 2023-07-12 15:08:37 +02:00 committed by GitHub
parent 26f4a13934
commit ff4b5db74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -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)

View File

@ -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"