mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-24 01:20:49 +08:00
* feat: add Restic and Kopia VM backups Add a type to Take Backup so VMs on third-party storage or Longhorn v2 can be backed up to S3. Native stays on the backup action, which has no type field. Restic and Kopia create the VirtualMachineBackup directly. Types a VM can't use stay in the dropdown, disabled, with the reason. Treat Restic and Kopia as remote backups in the restore routes, the schedule filter and the snapshot list. Show the type in the backup list. Add a form for the third-party-backup-config setting and the Kopia garbage collection option on the backup target, and stop resetting virtualHostedStyle when the backup target form opens. All of it sits behind a v1.10 feature flag. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: refine Take Backup for NFS targets and non-admin users Hide Take Backup on VMs that only have the snapshot action when the backup target is known not to be S3. Nothing can back those VMs up there, so they match the menu on main again. Only block Restic and Kopia on a backup target type the user can read. Non-admin users can't read the backup-target setting, so they were always told an S3 target was required. The webhook still decides. List why a type is unavailable under the Type select. Disabled options can't be reached by keyboard, so the reasons inside them were hidden from screen readers. Fall back to the default when third-party-backup-config doesn't parse, like the other settings forms, instead of showing a parse error banner. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: tighten Take Backup and backup config inputs after review - Offer Take Backup without the backup action only on VMs whose volumes Restic and Kopia support. The snapshot action isn't gated on a backup target, so users who can't read backup-target saw the menu on every VM. - Take the third-party-backup-config sizes in MiB, so a bare number is no longer saved as bytes. - Merge csi-driver-config value and default like the backend does, with the default's entries winning. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * feat: add the Restic and Kopia switch to the backup target The backend now rejects Restic and Kopia backups unless the S3 backup target has thirdPartyBackupEnabled set, and it is off by default. While it is on, every save of the target needs the repository password. - Add an "Enable Restic and Kopia Backups" checkbox to the S3 backup target form, dropped on NFS like Kopia garbage collection. - Show a required Repository Password field while the switch is on, and drop the password when the switch is off or the target is NFS, where the backend rejects it. - When the target is readable and the switch is off, Restic and Kopia are unavailable with a reason, after any volume reason, and Take Backup follows the same rule. - Rename the feature flag getter in the form and the dialog so it isn't confused with the setting field. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: offer Kopia garbage collection only while Restic and Kopia are on The backend removes the Kopia maintenance jobs whenever Restic and Kopia are turned off, so the option could be saved as on while nothing ran. Show it only while the switch is ticked, and drop it from the setting when the switch is turned off, like the repository password. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
172 lines
8.3 KiB
TypeScript
172 lines
8.3 KiB
TypeScript
export const HCI_SETTING = {
|
|
BACKUP_TARGET: 'backup-target',
|
|
CONTAINERD_REGISTRY: 'containerd-registry',
|
|
LOG_LEVEL: 'log-level',
|
|
SERVER_VERSION: 'server-version',
|
|
SERVER_FLAVOR: 'server-flavor',
|
|
UI_INDEX: 'ui-index',
|
|
UPGRADE_CHECKER_ENABLED: 'upgrade-checker-enabled',
|
|
UPGRADE_CHECKER_URL: 'upgrade-checker-url',
|
|
VLAN: 'vlan',
|
|
UI_SOURCE: 'ui-source',
|
|
UI_PL: 'ui-pl',
|
|
HTTP_PROXY: 'http-proxy',
|
|
ADDITIONAL_CA: 'additional-ca',
|
|
OVERCOMMIT_CONFIG: 'overcommit-config',
|
|
CLUSTER_REGISTRATION_URL: 'cluster-registration-url',
|
|
DEFAULT_STORAGE_CLASS: 'default-storage-class',
|
|
SUPPORT_BUNDLE_TIMEOUT: 'support-bundle-timeout',
|
|
SUPPORT_BUNDLE_EXPIRATION: 'support-bundle-expiration',
|
|
SUPPORT_BUNDLE_FILE_NAME: 'support-bundle-file-name',
|
|
SUPPORT_BUNDLE_IMAGE: 'support-bundle-image',
|
|
SUPPORT_BUNDLE_NODE_COLLECTION_TIMEOUT: 'support-bundle-node-collection-timeout',
|
|
STORAGE_NETWORK: 'storage-network',
|
|
RWX_NETWORK: 'rwx-network',
|
|
VM_FORCE_RESET_POLICY: 'vm-force-reset-policy',
|
|
SSL_CERTIFICATES: 'ssl-certificates',
|
|
SSL_PARAMETERS: 'ssl-parameters',
|
|
SUPPORT_BUNDLE_NAMESPACES: 'support-bundle-namespaces',
|
|
AUTO_DISK_PROVISION_PATHS: 'auto-disk-provision-paths',
|
|
RELEASE_DOWNLOAD_URL: 'release-download-url',
|
|
CCM_CSI_VERSION: 'harvester-csi-ccm-versions',
|
|
CSI_DRIVER_CONFIG: 'csi-driver-config',
|
|
THIRD_PARTY_BACKUP_CONFIG: 'third-party-backup-config',
|
|
CSI_ONLINE_EXPAND_VALIDATION: 'csi-online-expand-validation',
|
|
VM_TERMINATION_PERIOD: 'default-vm-termination-grace-period-seconds',
|
|
NTP_SERVERS: 'ntp-servers',
|
|
AUTO_ROTATE_RKE2_CERTS: 'auto-rotate-rke2-certs',
|
|
KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES: 'kubeconfig-default-token-ttl-minutes',
|
|
LONGHORN_V2_DATA_ENGINE_ENABLED: 'longhorn-v2-data-engine-enabled',
|
|
LONGHORN_V2_DATA_ENGINE_HUGEPAGE_ENABLED: 'longhorn-v2-data-engine-hugepage-enabled',
|
|
LONGHORN_V2_DATA_ENGINE_MEMORY_SIZE: 'longhorn-v2-data-engine-memory-size',
|
|
ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO: 'additional-guest-memory-overhead-ratio',
|
|
UPGRADE_CONFIG: 'upgrade-config',
|
|
VM_MIGRATION_NETWORK: 'vm-migration-network',
|
|
RANCHER_CLUSTER: 'rancher-cluster',
|
|
MAX_HOTPLUG_RATIO: 'max-hotplug-ratio',
|
|
KUBEVIRT_MIGRATION: 'kubevirt-migration',
|
|
INSTANCE_MANAGER_RESOURCES: 'instance-manager-resources',
|
|
CLUSTER_POD_SECURITY_STANDARD: 'cluster-pod-security-standard',
|
|
MAINTENANCE_MODE_DRAIN_TIMEOUT: 'maintenance-mode-drain-timeout'
|
|
};
|
|
|
|
export const HCI_ALLOWED_SETTINGS = {
|
|
[HCI_SETTING.BACKUP_TARGET]: {
|
|
kind: 'json', from: 'import', canReset: true
|
|
},
|
|
[HCI_SETTING.LOG_LEVEL]: {
|
|
kind: 'enum',
|
|
options: ['info', 'debug', 'trace']
|
|
},
|
|
[HCI_SETTING.VLAN]: {
|
|
kind: 'custom', from: 'import', alias: 'vlan'
|
|
},
|
|
[HCI_SETTING.AUTO_ROTATE_RKE2_CERTS]: {
|
|
kind: 'json',
|
|
from: 'import',
|
|
featureFlag: 'autoRotateRke2CertsSetting'
|
|
},
|
|
[HCI_SETTING.CSI_DRIVER_CONFIG]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.CSI_ONLINE_EXPAND_VALIDATION]: {
|
|
kind: 'json', from: 'import', featureFlag: 'csiOnlineExpandValidation'
|
|
},
|
|
[HCI_SETTING.SERVER_VERSION]: { readOnly: true },
|
|
[HCI_SETTING.SERVER_FLAVOR]: { readOnly: true },
|
|
[HCI_SETTING.UPGRADE_CHECKER_ENABLED]: { kind: 'boolean' },
|
|
[HCI_SETTING.UPGRADE_CHECKER_URL]: { kind: 'url' },
|
|
[HCI_SETTING.HTTP_PROXY]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.ADDITIONAL_CA]: {
|
|
kind: 'multiline', canReset: true, from: 'import'
|
|
},
|
|
[HCI_SETTING.OVERCOMMIT_CONFIG]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.SUPPORT_BUNDLE_TIMEOUT]: { kind: 'number' },
|
|
[HCI_SETTING.SUPPORT_BUNDLE_EXPIRATION]: { kind: 'number' },
|
|
[HCI_SETTING.SUPPORT_BUNDLE_FILE_NAME]: {
|
|
kind: 'string', canReset: true, featureFlag: 'supportBundleFileNameSetting'
|
|
},
|
|
[HCI_SETTING.SUPPORT_BUNDLE_NODE_COLLECTION_TIMEOUT]: { kind: 'number', featureFlag: 'supportBundleNodeCollectionTimeoutSetting' },
|
|
[HCI_SETTING.SUPPORT_BUNDLE_IMAGE]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.STORAGE_NETWORK]: {
|
|
kind: 'custom', from: 'import', canReset: true
|
|
},
|
|
[HCI_SETTING.RWX_NETWORK]: {
|
|
kind: 'json', from: 'import', canReset: true, featureFlag: 'rwxNetworkSetting'
|
|
},
|
|
[HCI_SETTING.VM_FORCE_RESET_POLICY]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.SSL_CERTIFICATES]: { kind: 'json', from: 'import' },
|
|
[HCI_SETTING.SSL_PARAMETERS]: {
|
|
kind: 'json', from: 'import', canReset: true
|
|
},
|
|
[HCI_SETTING.SUPPORT_BUNDLE_NAMESPACES]: { from: 'import', canReset: true },
|
|
[HCI_SETTING.AUTO_DISK_PROVISION_PATHS]: { canReset: true },
|
|
[HCI_SETTING.RELEASE_DOWNLOAD_URL]: { kind: 'url' },
|
|
[HCI_SETTING.CONTAINERD_REGISTRY]: {
|
|
kind: 'json', from: 'import', canReset: true
|
|
},
|
|
[HCI_SETTING.UI_SOURCE]: {
|
|
kind: 'enum',
|
|
options: ['auto', 'external', 'bundled']
|
|
},
|
|
[HCI_SETTING.UI_INDEX]: { kind: 'url' },
|
|
[HCI_SETTING.VM_TERMINATION_PERIOD]: { kind: 'string', from: 'import' },
|
|
[HCI_SETTING.NTP_SERVERS]: {
|
|
kind: 'json', from: 'import', canReset: true
|
|
},
|
|
[HCI_SETTING.KUBECONFIG_DEFAULT_TOKEN_TTL_MINUTES]: { kind: 'number', featureFlag: 'kubeconfigDefaultTokenTTLMinutesSetting' },
|
|
[HCI_SETTING.LONGHORN_V2_DATA_ENGINE_ENABLED]: {
|
|
kind: 'boolean',
|
|
preview: true,
|
|
featureFlag: 'longhornV2LVMSupport'
|
|
},
|
|
[HCI_SETTING.LONGHORN_V2_DATA_ENGINE_HUGEPAGE_ENABLED]: {
|
|
kind: 'boolean',
|
|
preview: true,
|
|
featureFlag: 'longhornV2HugepageSettings'
|
|
},
|
|
[HCI_SETTING.LONGHORN_V2_DATA_ENGINE_MEMORY_SIZE]: {
|
|
kind: 'number',
|
|
preview: true,
|
|
featureFlag: 'longhornV2HugepageSettings'
|
|
},
|
|
[HCI_SETTING.ADDITIONAL_GUEST_MEMORY_OVERHEAD_RATIO]: { kind: 'string', from: 'import' },
|
|
[HCI_SETTING.UPGRADE_CONFIG]: {
|
|
kind: 'json',
|
|
from: 'import',
|
|
featureFlag: 'upgradeConfigSetting',
|
|
docPath: 'UPGRADE_CONFIG_URL'
|
|
},
|
|
[HCI_SETTING.RANCHER_CLUSTER]: {
|
|
kind: 'custom', from: 'import', canReset: true, featureFlag: 'rancherClusterSetting'
|
|
},
|
|
[HCI_SETTING.MAX_HOTPLUG_RATIO]: { kind: 'number', featureFlag: 'cpuMemoryHotplug' },
|
|
[HCI_SETTING.VM_MIGRATION_NETWORK]: {
|
|
kind: 'json', from: 'import', canReset: true, featureFlag: 'vmNetworkMigration',
|
|
},
|
|
[HCI_SETTING.KUBEVIRT_MIGRATION]: {
|
|
kind: 'json', from: 'import', canReset: true, featureFlag: 'kubevirtMigration',
|
|
},
|
|
[HCI_SETTING.THIRD_PARTY_BACKUP_CONFIG]: {
|
|
kind: 'json', from: 'import', canReset: true, featureFlag: 'thirdPartyVMBackup',
|
|
},
|
|
[HCI_SETTING.INSTANCE_MANAGER_RESOURCES]: {
|
|
kind: 'json', from: 'import', featureFlag: 'instanceManagerResourcesSetting'
|
|
},
|
|
[HCI_SETTING.CLUSTER_POD_SECURITY_STANDARD]: {
|
|
kind: 'json', from: 'import', canReset: true, featureFlag: 'clusterPodSecurityStandardSetting'
|
|
},
|
|
[HCI_SETTING.MAINTENANCE_MODE_DRAIN_TIMEOUT]: {
|
|
kind: 'number', canReset: true, featureFlag: 'maintenanceModeDrainTimeoutSetting'
|
|
}
|
|
};
|
|
|
|
export const HCI_SINGLE_CLUSTER_ALLOWED_SETTING = {
|
|
[HCI_SETTING.CLUSTER_REGISTRATION_URL]: {
|
|
kind: 'custom',
|
|
from: 'import',
|
|
canReset: true,
|
|
},
|
|
[HCI_SETTING.UI_PL]: {
|
|
kind: 'custom', from: 'import', alias: 'branding'
|
|
}
|
|
};
|