Skip to content

Commit

Permalink
Merge pull request #12862 from rawagner/vsphere413
Browse files Browse the repository at this point in the history
OCPBUGS-14258: Add vSphere cluster field.
  • Loading branch information
openshift-merge-robot committed Jun 6, 2023
2 parents 237aa38 + 078a139 commit 9222e2a
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 273 deletions.
1 change: 1 addition & 0 deletions frontend/packages/vsphere-plugin/__tests__/utils.spec.ts
Expand Up @@ -9,6 +9,7 @@ const config: ConnectionFormContextValues = {
datacenter: 'my-datacenter',
defaultDatastore: 'my-default-ds',
folder: '/my/folder',
vCenterCluster: 'foo-cluster',
};

describe('mergeCloudProviderConfig', () => {
Expand Down
25 changes: 14 additions & 11 deletions frontend/packages/vsphere-plugin/locales/en/vsphere-plugin.json
Expand Up @@ -15,28 +15,31 @@
"Failed to patch kubecontrollermanager": "Failed to patch kubecontrollermanager",
"Failed to patch {{cm}}": "Failed to patch {{cm}}",
"Failed to create {{cm}} ConfigMap": "Failed to create {{cm}} ConfigMap",
"vsphere-connection-form-folderhelp-one": "Provide <1>datacenter</1> folder which contains VMs of the cluster, example: /<3>{{datacenter}}</3>/<5>vm</5>/<7>[MY_VMS_TOP_FOLDER]</7>.",
"vsphere-connection-form-datacenterhelp-one": "The name of an existing datacenter in the vSphere which the virtual machines backing this cluster are in.",
"vsphere-connection-form-datacenterhelp-two": "Note: Updating this value will break any existing PersistentVolumes.",
"vsphere-connection-form-datastorehelp-one": "The name of an existing datastore in the datacenter where the persistent volumes will be stored.",
"vsphere-connection-form-datastorehelp-two": "Note: Updating this value will break any existing PersistentVolumes.",
"Failed to add taint to node {{node}}": "Failed to add taint to node {{node}}",
"Failed to patch infrastructure spec": "Failed to patch infrastructure spec",
"Provide <1>datacenter</1> folder which contains VMs of the cluster, example: /<3>{{datacenter}}</3>/<5>vm</5>/<7>[MY_VMS_TOP_FOLDER]</7>.": "Provide <1>datacenter</1> folder which contains VMs of the cluster, example: /<3>{{datacenter}}</3>/<5>vm</5>/<7>[MY_VMS_TOP_FOLDER]</7>.",
"Enter the name of the vSphere data center that contains the virtual machines currently backing-up the cluster.": "Enter the name of the vSphere data center that contains the virtual machines currently backing-up the cluster.",
"Warning: Updating this value once the configuration has been saved will detach any existing PersistentVolumes.": "Warning: Updating this value once the configuration has been saved will detach any existing PersistentVolumes.",
"Select the data store in the vSphere data center that is to store the persistent data volumes.": "Select the data store in the vSphere data center that is to store the persistent data volumes.",
"Warning: Updating this value will break any existing PersistentVolumes.": "Warning: Updating this value will break any existing PersistentVolumes.",
"vCenter": "vCenter",
"Enter the network address the vCenter is running on. It can either be a domain name or IP. If you're unsure, you can try to determine the value from the vSphere Web Client address. Example: ": "Enter the network address the vCenter is running on. It can either be a domain name or IP. If you're unsure, you can try to determine the value from the vSphere Web Client address. Example: ",
"Can be both domain name or IP, see additional info how to get it.": "Can be both domain name or IP, see additional info how to get it.",
"Enter the network address of the vCenter server. It can either be a domain name or IP address. It appears in the vSphere web client URL. Example: ": "Enter the network address of the vCenter server. It can either be a domain name or IP address. It appears in the vSphere web client URL. Example: ",
"Can be either domain name or IP address. See tooltip for details.": "Can be either domain name or IP address. See tooltip for details.",
"vCenter cluster": "vCenter cluster",
"Username": "Username",
"The vSphere vCenter username. Mind to double-check it is correct, otherwise cluster nodes will get unschedulable (Known issue: OCPBUGS-2353).": "The vSphere vCenter username. Mind to double-check it is correct, otherwise cluster nodes will get unschedulable (Known issue: OCPBUGS-2353).",
"Enter the vSphere vCenter username. An incorrect username will render the cluster nodes unschedulable (known issue: OCPBUGS-2353).": "Enter the vSphere vCenter username. An incorrect username will render the cluster nodes unschedulable (known issue: OCPBUGS-2353).",
"Password": "Password",
"The password will be stored in a Secret in the kube-system namespace of this cluster. Mind to double-check it is correct, otherwise cluster nodes will get unschedulable (Known issue: OCPBUGS-2353).": "The password will be stored in a Secret in the kube-system namespace of this cluster. Mind to double-check it is correct, otherwise cluster nodes will get unschedulable (Known issue: OCPBUGS-2353).",
"Enter the vSphere vCenter password. The password will be stored in a Secret in the kube-system namespace for this cluster. An incorrect password will render the cluster nodes unschedulable (known issue: OCPBUGS-2353).": "Enter the vSphere vCenter password. The password will be stored in a Secret in the kube-system namespace for this cluster. An incorrect password will render the cluster nodes unschedulable (known issue: OCPBUGS-2353).",
"Datacenter": "Datacenter",
"Default data store": "Default data store",
"Virtual Machine Folder": "Virtual Machine Folder",
"vSphere Problem Detector (can be outdated)": "vSphere Problem Detector (can be outdated)",
"Retry": "Retry",
"Delayed propagation of configuration": "Delayed propagation of configuration",
"After saving the configuration, it might take approximately 1 hour to see if the settings are correct and the operators' statuses are updated, nodes will get rebooted.": "After saving the configuration, it might take approximately 1 hour to see if the settings are correct and the operators' statuses are updated, nodes will get rebooted.",
"The configuration process updates operator statuses and reboots nodes. This process typically takes about an hour. Existing resources such as previously bound Persistent Volume Claims might become disconnected.": "The configuration process updates operator statuses and reboots nodes. This process typically takes about an hour. Existing resources such as previously bound Persistent Volume Claims might become disconnected.",
"Note, that existing resources (like already bound PVCs) might get broken by these changes.": "Note, that existing resources (like already bound PVCs) might get broken by these changes.",
"Saving": "Saving",
"Cancel": "Cancel",
"Saving": "Saving",
"Save configuration": "Save configuration",
"vSphere connection configuration": "vSphere connection configuration",
"Pending": "Pending",
Expand Down
Expand Up @@ -12,51 +12,45 @@ export const ConnectionFormContextProvider: React.FC<{
const [datacenter, setDatacenter] = React.useState<string>('');
const [defaultDatastore, setDefaultDatastore] = React.useState<string>('');
const [folder, setFolder] = React.useState<string>('');
const [vCenterCluster, setVCenterCluster] = React.useState<string>('');
const [isDirty, setDirty] = React.useState(false);

const value = React.useMemo(
(): ConnectionFormContextData => ({
isDirty,
setDirty,
const value = React.useMemo<ConnectionFormContextData>(() => {
const formFunction = (func: (v: string) => void) => (val: string) => {
func(val);
setDirty(true);
};

const setters = {
setVcenter,
setUsername,
setPassword,
setDatacenter,
setDefaultDatastore,
setFolder,
setVCenterCluster,
};
const values = {
vcenter,
setVcenter: (v) => {
setDirty(true);
setVcenter(v);
},

username,
setUsername: (v) => {
setDirty(true);
setUsername(v);
},

password,
setPassword: (v) => {
setDirty(true);
setPassword(v);
},

datacenter,
setDatacenter: (v) => {
setDirty(true);
setDatacenter(v);
},

defaultDatastore,
setDefaultDatastore: (v) => {
setDirty(true);
setDefaultDatastore(v);
},

folder,
setFolder: (v) => {
setDirty(true);
setFolder(v);
},
}),
[datacenter, defaultDatastore, folder, isDirty, password, username, vcenter],
);
vCenterCluster,
};

return {
values,
setters: Object.keys(setters).reduce((acc, curr) => {
acc[curr] = formFunction(setters[curr]);
return acc;
}, {} as ConnectionFormContextData['setters']),
isDirty,
setDirty,
isValid: Object.values(values).every((v) => v?.trim()),
};
}, [datacenter, defaultDatastore, folder, isDirty, password, username, vcenter, vCenterCluster]);

return <ConnectionFormContext.Provider value={value}>{children}</ConnectionFormContext.Provider>;
};
Expand Down
14 changes: 0 additions & 14 deletions frontend/packages/vsphere-plugin/src/components/InProgress.tsx

This file was deleted.

0 comments on commit 9222e2a

Please sign in to comment.