in shardingsphere-operator/pkg/reconcile/storagenode/aws/rdscluster.go [31:74]
func validateCreateRDSClusterParams(node *v1alpha1.StorageNode, paramsPtr *map[string]string) error {
requiredParams := map[string]string{
"instanceClass": "instance class is empty",
"engine": "engine is empty",
"engineVersion": "engine version is empty",
"clusterIdentifier": "cluster identifier is empty",
"masterUsername": "master username is empty",
"masterUserPassword": "master user password is empty",
"allocatedStorage": "allocated storage is empty",
"iops": "iops is empty",
"storageType": "storage type is empty",
}
params := *paramsPtr
if v, ok := node.Annotations[v1alpha1.AnnotationsClusterIdentifier]; !ok || v == "" {
return errors.New("cluster identifier is empty")
} else {
params["clusterIdentifier"] = v
}
if len(params["clusterIdentifier"]) > 50 {
return errors.New("cluster identifier is too long, max length is 50")
}
for k, v := range requiredParams {
if val, ok := params[k]; !ok || val == "" {
return fmt.Errorf(v)
}
}
// valid mysql engine version
if params["engine"] == "mysql" {
version := strings.Split(params["engineVersion"], ".")[0]
if version != "8" {
return fmt.Errorf("mysql engine version is not supported, only support 8.x")
}
}
if params["storageType"] != "io1" {
return fmt.Errorf("storage type is not supported, only support io1")
}
return nil
}