@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
36 lines • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNetworkInitialValues = void 0;
const utils_1 = require("../../../common/components/clusterConfiguration/utils");
const clusterSelectors_1 = require("../../../common/selectors/clusterSelectors");
const config_1 = require("../../../common/config");
const getInitHostSubnet = (cluster, managedNetworkingType) => {
var _a, _b;
if (!(0, clusterSelectors_1.isSNO)(cluster) && managedNetworkingType === 'userManaged') {
return config_1.NO_SUBNET_SET;
}
const machineNetworkCIDR = (0, clusterSelectors_1.selectMachineNetworkCIDR)(cluster);
if (machineNetworkCIDR) {
return (0, utils_1.getSubnetFromMachineNetworkCidr)(machineNetworkCIDR);
}
if (managedNetworkingType === 'clusterManaged') {
return (_b = (_a = (0, utils_1.getHostSubnets)(cluster)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.subnet;
}
};
const getNetworkInitialValues = (cluster, defaultNetworkSettings) => {
const managedNetworkingType = cluster.userManagedNetworking ? 'userManaged' : 'clusterManaged';
return {
clusterNetworkCidr: (0, clusterSelectors_1.selectClusterNetworkCIDR)(cluster) || defaultNetworkSettings.clusterNetworkCidr,
clusterNetworkHostPrefix: (0, clusterSelectors_1.selectClusterNetworkHostPrefix)(cluster) || defaultNetworkSettings.clusterNetworkHostPrefix,
serviceNetworkCidr: (0, clusterSelectors_1.selectServiceNetworkCIDR)(cluster) || defaultNetworkSettings.serviceNetworkCidr,
apiVips: cluster.apiVips,
ingressVips: cluster.ingressVips,
sshPublicKey: cluster.sshPublicKey || '',
hostSubnet: getInitHostSubnet(cluster, managedNetworkingType) || config_1.NO_SUBNET_SET,
vipDhcpAllocation: cluster.vipDhcpAllocation,
managedNetworkingType,
networkType: cluster.networkType || config_1.NETWORK_TYPE_OVN,
};
};
exports.getNetworkInitialValues = getNetworkInitialValues;
//# sourceMappingURL=networkConfigurationValidation.js.map