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:
Daniel Weiße 2023-03-31 19:19:10 +02:00 committed by GitHub
parent aed9b8d5f5
commit 62c165750f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 112 deletions

View file

@ -64,7 +64,7 @@ type Config struct {
Image string `yaml:"image" validate:"required,version_compatibility"`
// description: |
// Name of the cluster.
Name string `yaml:"name" validate:"valid_name"` // TODO: v2.7: Use "required" validation for name
Name string `yaml:"name" validate:"valid_name,required"`
// description: |
// Size (in GB) of a node's disk to store the non-volatile state.
StateDiskSizeGB int `yaml:"stateDiskSizeGB" validate:"min=0"`
@ -72,36 +72,17 @@ type Config struct {
// Kubernetes version to be installed into the cluster.
KubernetesVersion string `yaml:"kubernetesVersion" validate:"required,supported_k8s_version"`
// description: |
// Microservice version to be installed into the cluster. Setting this value is optional until v2.7. Defaults to the version of the CLI.
MicroserviceVersion string `yaml:"microserviceVersion" validate:"omitempty,version_compatibility"`
// Microservice version to be installed into the cluster. Defaults to the version of the CLI.
MicroserviceVersion string `yaml:"microserviceVersion" validate:"required,version_compatibility"`
// description: |
// DON'T USE IN PRODUCTION: enable debug mode and use debug images. For usage, see: https://github.com/edgelesssys/constellation/blob/main/debugd/README.md
DebugCluster *bool `yaml:"debugCluster" validate:"required"`
// description: |
// Attestation variant used to verify the integrity of a node.
AttestationVariant string `yaml:"attestationVariant" validate:"valid_attestation_variant"` // TODO: v2.8: Mark required
AttestationVariant string `yaml:"attestationVariant,omitempty" validate:"valid_attestation_variant"` // TODO: v2.8: Mark required
// description: |
// Supported cloud providers and their specific configurations.
Provider ProviderConfig `yaml:"provider" validate:"dive"`
// description: |
// Configuration to apply during constellation upgrade.
// examples:
// - value: 'UpgradeConfig{ Image: "", Measurements: Measurements{} }'
Upgrade UpgradeConfig `yaml:"upgrade,omitempty" validate:"required"`
}
// UpgradeConfig defines configuration used during constellation upgrade.
type UpgradeConfig struct {
// description: |
// Updated Constellation machine image to install on all nodes.
Image string `yaml:"image"`
// description: |
// Measurements of the updated image.
Measurements Measurements `yaml:"measurements"`
// description: |
// temporary field for upgrade migration
// TODO(AB#2654): Remove with refactoring upgrade plan command
CSP cloudprovider.Provider `yaml:"csp"`
}
// ProviderConfig are cloud-provider specific configuration values used by the CLI.
@ -639,9 +620,6 @@ func (c *Config) Validate(force bool) error {
// Register provider validation
validate.RegisterStructValidation(validateProvider, ProviderConfig{})
// register custom validator that prints a deprecation warning.
validate.RegisterStructValidation(validateUpgradeConfig, UpgradeConfig{})
err := validate.Struct(c)
if err == nil {
return nil