check for cluster created without backup config

rancher/rancher#17940
This commit is contained in:
Westly Wright 2019-02-13 16:43:09 -07:00
parent 2f30632340
commit c2ce463ac2
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
1 changed files with 19 additions and 5 deletions

View File

@ -884,7 +884,9 @@ export default InputTextFile.extend(ClusterDriver, {
migrateLegacyEtcdSnapshotSettings() {
const { cluster } = this;
const { retention, creation } = cluster.rancherKubernetesEngineConfig.services.etcd;
let {
retention, creation, backupConfig
} = cluster.rancherKubernetesEngineConfig.services.etcd;
let creationMatch = creation.match(/^((\d+)h)?((\d+)m)?((\d+)s)?$/);
let momentReady = [creationMatch[2], creationMatch[4], creationMatch[6]];
@ -901,10 +903,22 @@ export default InputTextFile.extend(ClusterDriver, {
hasLegacySnapshotSettings: true,
});
setProperties(cluster.rancherKubernetesEngineConfig.services.etcd, {
'backupConfig.intervalHours': parsedDurationAsHours,
snapshot: false,
});
if (backupConfig) {
setProperties(cluster.rancherKubernetesEngineConfig.services.etcd, {
'backupConfig.intervalHours': parsedDurationAsHours,
snapshot: false,
});
} else {
backupConfig = this.globalStore.createRecord({
type: 'backupConfig',
intervalHours: parsedDurationAsHours
});
setProperties(cluster.rancherKubernetesEngineConfig.services.etcd, {
backupConfig,
snapshot: false,
});
}
},
initRootDockerDirectory() {