@openshift-assisted/ui-lib 2.52.2 → 5.0.0-cim

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/build/@types/cim/components/ClusterDeployment/NetworkConfiguration.d.ts +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/NetworkConfiguration.d.ts.map +1 -1
  3. package/build/@types/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.d.ts.map +1 -1
  4. package/build/@types/cim/components/ClusterDeployment/networkConfigurationValidation.d.ts +1 -1
  5. package/build/@types/cim/components/ClusterDeployment/networkConfigurationValidation.d.ts.map +1 -1
  6. package/build/@types/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.d.ts +5 -0
  7. package/build/@types/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.d.ts.map +1 -0
  8. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts +4 -4
  9. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts.map +1 -1
  10. package/build/@types/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.d.ts.map +1 -1
  11. package/build/@types/cim/components/helpers/versions.d.ts +2 -2
  12. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  13. package/build/@types/cim/components/helpers/versions.test.d.ts +2 -0
  14. package/build/@types/cim/components/helpers/versions.test.d.ts.map +1 -0
  15. package/build/@types/cim/components/modals/CimConfiguration/CimConfigurationModal.d.ts.map +1 -1
  16. package/build/@types/cim/components/modals/CimConfiguration/persist.d.ts +14 -17
  17. package/build/@types/cim/components/modals/CimConfiguration/persist.d.ts.map +1 -1
  18. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts +1 -1
  19. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts.map +1 -1
  20. package/build/@types/common/components/clusterWizard/customManifests/CustomManifestsAlert.d.ts +6 -0
  21. package/build/@types/common/components/clusterWizard/customManifests/CustomManifestsAlert.d.ts.map +1 -0
  22. package/build/@types/common/components/clusterWizard/customManifests/index.d.ts +2 -0
  23. package/build/@types/common/components/clusterWizard/customManifests/index.d.ts.map +1 -0
  24. package/build/@types/common/components/clusterWizard/index.d.ts +2 -0
  25. package/build/@types/common/components/clusterWizard/index.d.ts.map +1 -1
  26. package/build/@types/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.d.ts +2 -1
  27. package/build/@types/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.d.ts.map +1 -1
  28. package/build/@types/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.d.ts +2 -1
  29. package/build/@types/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.d.ts.map +1 -1
  30. package/build/@types/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.d.ts +3 -0
  31. package/build/@types/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.d.ts.map +1 -0
  32. package/build/@types/common/components/clusterWizard/networkingSteps/index.d.ts +1 -0
  33. package/build/@types/common/components/clusterWizard/networkingSteps/index.d.ts.map +1 -1
  34. package/build/@types/common/components/ui/formik/utils.d.ts +1 -0
  35. package/build/@types/common/components/ui/formik/utils.d.ts.map +1 -1
  36. package/build/@types/common/config/constants.d.ts +2 -2
  37. package/build/@types/common/config/constants.d.ts.map +1 -1
  38. package/build/@types/common/types/networkType.d.ts +2 -1
  39. package/build/@types/common/types/networkType.d.ts.map +1 -1
  40. package/build/@types/common/validationSchemas/networkingValidation.d.ts +10 -0
  41. package/build/@types/common/validationSchemas/networkingValidation.d.ts.map +1 -1
  42. package/build/@types/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.d.ts.map +1 -1
  43. package/build/@types/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.d.ts.map +1 -1
  44. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.d.ts.map +1 -1
  45. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts.map +1 -1
  46. package/build/@types/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.d.ts.map +1 -1
  47. package/build/@types/ocm/components/clusterConfiguration/review/ReviewSummary.d.ts.map +1 -1
  48. package/build/@types/ocm/components/{clusterDetail/ClusterProperties.d.ts → clusterConfiguration/review/utils.d.ts} +1 -8
  49. package/build/@types/ocm/components/clusterConfiguration/review/utils.d.ts.map +1 -0
  50. package/build/@types/ocm/components/clusterConfiguration/review/utils.test.d.ts +2 -0
  51. package/build/@types/ocm/components/clusterConfiguration/review/utils.test.d.ts.map +1 -0
  52. package/build/@types/ocm/components/clusterDetail/index.d.ts +0 -1
  53. package/build/@types/ocm/components/clusterDetail/index.d.ts.map +1 -1
  54. package/build/@types/ocm/components/clusterWizard/ClusterDetailsForm.d.ts.map +1 -1
  55. package/build/@types/ocm/components/clusters/AssistedInstallerHeader.d.ts +5 -1
  56. package/build/@types/ocm/components/clusters/AssistedInstallerHeader.d.ts.map +1 -1
  57. package/build/@types/ocm/hooks/useClusterCustomManifests.d.ts.map +1 -1
  58. package/build/@types/ocm/hooks/useUISettings.d.ts.map +1 -1
  59. package/build/@types/ocm/services/ClusterDetailsService.d.ts +2 -1
  60. package/build/@types/ocm/services/ClusterDetailsService.d.ts.map +1 -1
  61. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js +46 -7
  62. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js.map +1 -1
  63. package/build/cjs/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.js +22 -21
  64. package/build/cjs/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.js.map +1 -1
  65. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js +25 -9
  66. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js.map +1 -1
  67. package/build/cjs/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.js +35 -0
  68. package/build/cjs/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.js.map +1 -0
  69. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js +13 -18
  70. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js.map +1 -1
  71. package/build/cjs/cim/components/Hypershift/modals/NodePoolForm.js +1 -1
  72. package/build/cjs/cim/components/Hypershift/modals/NodePoolForm.js.map +1 -1
  73. package/build/cjs/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.js +1 -4
  74. package/build/cjs/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.js.map +1 -1
  75. package/build/cjs/cim/components/helpers/versions.js +39 -28
  76. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  77. package/build/cjs/cim/components/helpers/versions.test.js +423 -0
  78. package/build/cjs/cim/components/helpers/versions.test.js.map +1 -0
  79. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigurationModal.js +39 -16
  80. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigurationModal.js.map +1 -1
  81. package/build/cjs/cim/components/modals/CimConfiguration/persist.js +96 -136
  82. package/build/cjs/cim/components/modals/CimConfiguration/persist.js.map +1 -1
  83. package/build/cjs/common/components/clusterWizard/customManifests/CustomManifestsAlert.js +32 -0
  84. package/build/cjs/common/components/clusterWizard/customManifests/CustomManifestsAlert.js.map +1 -0
  85. package/build/cjs/common/components/clusterWizard/customManifests/index.js +5 -0
  86. package/build/cjs/common/components/clusterWizard/customManifests/index.js.map +1 -0
  87. package/build/cjs/common/components/clusterWizard/index.js +2 -0
  88. package/build/cjs/common/components/clusterWizard/index.js.map +1 -1
  89. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js +8 -2
  90. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js.map +1 -1
  91. package/build/cjs/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.js +2 -2
  92. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js +29 -19
  93. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js.map +1 -1
  94. package/build/cjs/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.js +20 -0
  95. package/build/cjs/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.js.map +1 -0
  96. package/build/cjs/common/components/clusterWizard/networkingSteps/index.js +1 -0
  97. package/build/cjs/common/components/clusterWizard/networkingSteps/index.js.map +1 -1
  98. package/build/cjs/common/components/ui/formik/utils.js +5 -1
  99. package/build/cjs/common/components/ui/formik/utils.js.map +1 -1
  100. package/build/cjs/common/config/constants.js +13 -2
  101. package/build/cjs/common/config/constants.js.map +1 -1
  102. package/build/cjs/common/types/networkType.js +9 -8
  103. package/build/cjs/common/types/networkType.js.map +1 -1
  104. package/build/cjs/common/validationSchemas/networkingValidation.js +19 -1
  105. package/build/cjs/common/validationSchemas/networkingValidation.js.map +1 -1
  106. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js +4 -1
  107. package/build/cjs/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.js.map +1 -1
  108. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js +1 -20
  109. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js.map +1 -1
  110. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +1 -1
  111. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
  112. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js +6 -9
  113. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js.map +1 -1
  114. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js +4 -4
  115. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js.map +1 -1
  116. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewClusterDetailTable.js +2 -2
  117. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewClusterDetailTable.js.map +1 -1
  118. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.js +6 -5
  119. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.js.map +1 -1
  120. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewSummary.js +5 -2
  121. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewSummary.js.map +1 -1
  122. package/build/cjs/ocm/components/clusterConfiguration/review/utils.js +57 -0
  123. package/build/cjs/ocm/components/clusterConfiguration/review/utils.js.map +1 -0
  124. package/build/cjs/ocm/components/{clusterDetail/ClusterProperties.test.js → clusterConfiguration/review/utils.test.js} +13 -13
  125. package/build/cjs/ocm/components/clusterConfiguration/review/utils.test.js.map +1 -0
  126. package/build/cjs/ocm/components/clusterDetail/index.js +1 -3
  127. package/build/cjs/ocm/components/clusterDetail/index.js.map +1 -1
  128. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js +10 -1
  129. package/build/cjs/ocm/components/clusterWizard/ClusterDetailsForm.js.map +1 -1
  130. package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js +2 -2
  131. package/build/cjs/ocm/components/clusters/AssistedInstallerHeader.js.map +1 -1
  132. package/build/cjs/ocm/components/clusters/ClusterPage.js +1 -1
  133. package/build/cjs/ocm/components/clusters/ClusterPage.js.map +1 -1
  134. package/build/cjs/ocm/components/featureSupportLevels/featureStateUtils.js +1 -1
  135. package/build/cjs/ocm/hooks/useClusterCustomManifests.js +3 -15
  136. package/build/cjs/ocm/hooks/useClusterCustomManifests.js.map +1 -1
  137. package/build/cjs/ocm/hooks/useUISettings.js +1 -1
  138. package/build/cjs/ocm/hooks/useUISettings.js.map +1 -1
  139. package/build/cjs/ocm/services/ClusterDetailsService.js +4 -2
  140. package/build/cjs/ocm/services/ClusterDetailsService.js.map +1 -1
  141. package/lib/cim/components/ClusterDeployment/NetworkConfiguration.tsx +55 -6
  142. package/lib/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.tsx +18 -2
  143. package/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts +22 -8
  144. package/lib/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.tsx +81 -0
  145. package/lib/cim/components/ClusterDeployment/use-networking-formik.ts +14 -22
  146. package/lib/cim/components/Hypershift/modals/NodePoolForm.tsx +2 -2
  147. package/lib/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.tsx +2 -5
  148. package/lib/cim/components/helpers/versions.test.ts +465 -0
  149. package/lib/cim/components/helpers/versions.ts +37 -31
  150. package/lib/cim/components/modals/CimConfiguration/CimConfigurationModal.tsx +45 -18
  151. package/lib/cim/components/modals/CimConfiguration/persist.ts +97 -199
  152. package/lib/cim/types/k8s/agent-cluster-install.ts +1 -1
  153. package/lib/common/components/clusterWizard/customManifests/CustomManifestsAlert.tsx +39 -0
  154. package/lib/common/components/clusterWizard/customManifests/index.tsx +1 -0
  155. package/lib/common/components/clusterWizard/index.ts +2 -0
  156. package/lib/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.tsx +8 -1
  157. package/lib/common/components/clusterWizard/networkingSteps/ManagedNetworkingControlGroup.tsx +2 -2
  158. package/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx +36 -26
  159. package/lib/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.tsx +28 -0
  160. package/lib/common/components/clusterWizard/networkingSteps/index.ts +1 -0
  161. package/lib/common/components/ui/formik/utils.ts +6 -0
  162. package/lib/common/config/constants.ts +14 -1
  163. package/lib/common/types/networkType.ts +9 -8
  164. package/lib/common/validationSchemas/networkingValidation.tsx +39 -1
  165. package/lib/ocm/components/clusterConfiguration/ControlPlaneNodesDropdown.tsx +6 -3
  166. package/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx +10 -45
  167. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +2 -2
  168. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx +7 -24
  169. package/lib/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.ts +6 -5
  170. package/lib/ocm/components/clusterConfiguration/review/ReviewClusterDetailTable.tsx +1 -1
  171. package/lib/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.tsx +10 -4
  172. package/lib/ocm/components/clusterConfiguration/review/ReviewSummary.tsx +9 -2
  173. package/lib/ocm/components/{clusterDetail/ClusterProperties.test.ts → clusterConfiguration/review/utils.test.ts} +1 -1
  174. package/lib/ocm/components/clusterConfiguration/review/utils.tsx +61 -0
  175. package/lib/ocm/components/clusterDetail/index.ts +0 -1
  176. package/lib/ocm/components/clusterWizard/ClusterDetailsForm.tsx +10 -1
  177. package/lib/ocm/components/clusters/AssistedInstallerHeader.tsx +6 -2
  178. package/lib/ocm/components/clusters/ClusterPage.tsx +1 -1
  179. package/lib/ocm/components/featureSupportLevels/featureStateUtils.ts +1 -1
  180. package/lib/ocm/hooks/useClusterCustomManifests.ts +3 -0
  181. package/lib/ocm/hooks/useUISettings.ts +3 -1
  182. package/lib/ocm/services/ClusterDetailsService.ts +6 -0
  183. package/package.json +7 -7
  184. package/build/@types/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.d.ts +0 -7
  185. package/build/@types/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.d.ts.map +0 -1
  186. package/build/@types/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.d.ts +0 -8
  187. package/build/@types/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.d.ts.map +0 -1
  188. package/build/@types/ocm/components/clusterDetail/ClusterProperties.d.ts.map +0 -1
  189. package/build/@types/ocm/components/clusterDetail/ClusterProperties.test.d.ts +0 -2
  190. package/build/@types/ocm/components/clusterDetail/ClusterProperties.test.d.ts.map +0 -1
  191. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js +0 -33
  192. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js.map +0 -1
  193. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.js +0 -40
  194. package/build/cjs/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.js.map +0 -1
  195. package/build/cjs/ocm/components/clusterDetail/ClusterProperties.js +0 -77
  196. package/build/cjs/ocm/components/clusterDetail/ClusterProperties.js.map +0 -1
  197. package/build/cjs/ocm/components/clusterDetail/ClusterProperties.test.js.map +0 -1
  198. package/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx +0 -74
  199. package/lib/ocm/components/clusterDetail/AssistedInstallerExtraDetailCard.tsx +0 -69
  200. package/lib/ocm/components/clusterDetail/ClusterProperties.tsx +0 -169
@@ -4,8 +4,8 @@ import {
4
4
  k8sListItems,
5
5
  k8sPatch,
6
6
  K8sResourceCommon,
7
+ Patch,
7
8
  } from '@openshift-console/dynamic-plugin-sdk';
8
- import { AlertVariant } from '@patternfly/react-core';
9
9
  import { TFunction } from 'i18next';
10
10
  import { getErrorMessage } from '../../../../common/utils';
11
11
 
@@ -13,42 +13,21 @@ import {
13
13
  AgentServiceConfigK8sResource,
14
14
  AgentServiceConfigModel,
15
15
  IngressControllerModel,
16
- K8sPatch,
17
16
  ProvisioningModel,
18
17
  RouteK8sResource,
19
18
  RouteModel,
20
19
  } from '../../../types';
21
- import { LOCAL_STORAGE_ID_LAST_UPDATE_TIMESTAMP } from './utils';
22
20
  import { appendPatch } from '../../../utils';
23
-
24
- export type SetErrorFuncType = ({
25
- title,
26
- message,
27
- variant,
28
- }: {
29
- title: string;
30
- message?: string;
31
- variant?: AlertVariant;
32
- }) => void;
21
+ import { CimConfigurationValues } from './types';
33
22
 
34
23
  const ASSISTED_IMAGE_SERVICE_ROUTE_PREFIX = 'assisted-image-service-multicluster-engine';
35
24
 
36
- // Since we do not know MCE's namespace, query all routes,
37
- // Find assisted-image-service's one and parse domain from there.
38
- const getAssistedImageServiceRoute = async (
39
- t: TFunction,
40
- setError: SetErrorFuncType,
41
- ): Promise<RouteK8sResource | undefined> => {
25
+ const getAssistedImageServiceRoute = async (t: TFunction): Promise<RouteK8sResource> => {
42
26
  let allRoutes: RouteK8sResource[] = [];
43
27
  try {
44
28
  allRoutes = await k8sListItems({ model: RouteModel, queryParams: {} });
45
29
  } catch (e) {
46
- // console.error('Failed to read all routes: ', allRoutes);
47
- setError({
48
- title: t('ai:Failed to save configuration'),
49
- message: t('ai:Can not query routes.'),
50
- });
51
- return undefined;
30
+ throw new Error(`${t('ai:Failed to save configuration')}: ${getErrorMessage(e)}`);
52
31
  }
53
32
 
54
33
  const assistedImageServiceRoute = allRoutes?.find(
@@ -56,54 +35,41 @@ const getAssistedImageServiceRoute = async (
56
35
  );
57
36
 
58
37
  if (!assistedImageServiceRoute?.spec?.host) {
59
- setError({
60
- title: t('ai:Failed to save configuration'),
61
- message: t('ai:Can not find host of the assisted-image-service route'),
62
- });
63
- return undefined;
38
+ throw new Error(
39
+ `${t('ai:Failed to save configuration')}: ${t(
40
+ 'ai:Can not find host of the assisted-image-service route',
41
+ )}`,
42
+ );
64
43
  }
65
44
 
66
45
  return assistedImageServiceRoute;
67
46
  };
68
47
 
69
- // There are many ways how to get the domain name, let's follow the documentation.
70
- const getClusterDomain = (
71
- t: TFunction,
72
- setError: SetErrorFuncType,
73
- assistedImageServiceRoute: RouteK8sResource,
74
- ): string | undefined => {
48
+ const getClusterDomain = (t: TFunction, assistedImageServiceRoute: RouteK8sResource) => {
75
49
  const prefix = `${ASSISTED_IMAGE_SERVICE_ROUTE_PREFIX}.`;
76
50
  const host: string = assistedImageServiceRoute.spec?.host || '';
77
51
  const appsDomain = host.substring(host.indexOf(prefix) + prefix.length);
78
52
 
79
- // the appsDomain can be prefixed either by "apps." or "nlb-apps." so search for first dot
80
53
  const domain = appsDomain.substring(appsDomain.indexOf('.') + 1);
81
54
 
82
55
  if (!domain) {
83
- // It must be present
84
- // console.error('Can not find domain in assistedImageServiceRoute: ', assistedImageServiceRoute);
85
- setError({
86
- title: t('ai:Can not find cluster domain.'),
87
- });
56
+ throw new Error(t('ai:Can not find cluster domain.'));
88
57
  }
89
58
 
90
59
  return domain;
91
60
  };
92
61
 
93
- // Keep this function in sync with getClusterDomain()
94
62
  const patchAssistedImageServiceRoute = async (
95
63
  t: TFunction,
96
- setError: SetErrorFuncType,
97
-
98
64
  assistedImageServiceRoute: RouteK8sResource,
99
65
  domain: string,
100
- ): Promise<boolean> => {
66
+ ) => {
101
67
  const newHost = `${ASSISTED_IMAGE_SERVICE_ROUTE_PREFIX}.nlb-apps.${domain}`;
102
68
 
103
69
  const labels = assistedImageServiceRoute.metadata?.labels || {};
104
70
  labels['router-type'] = 'nlb';
105
71
 
106
- const patches = [
72
+ const patches: Patch[] = [
107
73
  {
108
74
  op: 'replace',
109
75
  path: '/spec/host',
@@ -123,38 +89,28 @@ const patchAssistedImageServiceRoute = async (
123
89
  data: patches,
124
90
  });
125
91
  } catch (e) {
126
- // console.error('Failed to patch assisted-image-service route: ', e, patches);
127
- setError({
128
- title: t('ai:Failed to patch assisted-image-service route for new domain.'),
129
- });
130
- return false;
92
+ throw new Error(
93
+ `${t('ai:Failed to patch assisted-image-service route for new domain.')}: ${getErrorMessage(
94
+ e,
95
+ )}`,
96
+ );
131
97
  }
132
-
133
- return true;
134
98
  };
135
99
 
136
- export const isIngressController = async (): Promise<boolean> => {
100
+ export async function isIngressController() {
137
101
  try {
138
102
  await k8sGet({
139
103
  name: 'ingress-controller-with-nlb',
140
104
  ns: 'openshift-ingress-operator',
141
105
  model: IngressControllerModel,
142
106
  });
143
-
144
107
  return true;
145
108
  } catch {
146
109
  return false;
147
110
  }
148
- };
149
-
150
- const createIngressController = async (
151
- t: TFunction,
152
- setError: SetErrorFuncType,
153
-
154
- domain: string,
155
- ): Promise<boolean> => {
156
- // Assumption: the IngressController resource is not present - ensured at higher level
111
+ }
157
112
 
113
+ const createIngressController = async (t: TFunction, domain: string) => {
158
114
  const ingressController = {
159
115
  apiVersion: 'operator.openshift.io/v1',
160
116
  kind: 'IngressController',
@@ -186,71 +142,45 @@ const createIngressController = async (
186
142
 
187
143
  try {
188
144
  await k8sCreate({ model: IngressControllerModel, data: ingressController });
189
- return true;
190
145
  } catch (e) {
191
- // console.error('Create IngressController error: ', e);
192
- setError({
193
- title: t('ai:Failed to create IngressController'),
194
- });
146
+ throw new Error(`${t('ai:Failed to create IngressController')}: ${getErrorMessage(e)}`);
195
147
  }
196
-
197
- return false;
198
148
  };
199
149
 
200
- const patchProvisioningConfiguration = async ({
201
- t,
202
- setError,
203
- }: {
204
- t: TFunction;
205
- setError: SetErrorFuncType;
206
- }) => {
207
- try {
208
- const provisioning = await k8sGet<
209
- K8sResourceCommon & { spec?: { watchAllNamespaces?: boolean } }
210
- >({
211
- model: ProvisioningModel,
212
- name: 'provisioning-configuration',
213
- });
214
-
215
- const patches = [
216
- {
217
- op: provisioning.spec?.watchAllNamespaces ? 'replace' : 'add',
218
- path: '/spec/watchAllNamespaces',
219
- value: true,
220
- },
221
- ];
150
+ export const patchProvisioning = async () => {
151
+ const provisioning = await k8sGet<
152
+ K8sResourceCommon & { spec?: { watchAllNamespaces?: boolean } }
153
+ >({
154
+ model: ProvisioningModel,
155
+ name: 'provisioning-configuration',
156
+ });
222
157
 
223
- await k8sPatch({
224
- model: ProvisioningModel,
225
- resource: provisioning,
226
- data: patches,
227
- });
228
- } catch (e) {
229
- // console.error('Failed to patch provisioning-configuration: ', e);
230
- setError({
231
- title: t('ai:Failed to configure provisioning to enable registering hosts via BMC.'),
232
- message: getErrorMessage(e),
233
- variant: AlertVariant.warning,
234
- });
158
+ if (provisioning.spec?.watchAllNamespaces) {
159
+ return;
235
160
  }
161
+
162
+ const patches = [
163
+ {
164
+ op: provisioning.spec?.watchAllNamespaces === false ? 'replace' : 'add',
165
+ path: '/spec/watchAllNamespaces',
166
+ value: true,
167
+ },
168
+ ];
169
+
170
+ await k8sPatch({
171
+ model: ProvisioningModel,
172
+ resource: provisioning,
173
+ data: patches,
174
+ });
236
175
  };
237
176
 
238
- const createAgentServiceConfig = async ({
177
+ export const createAgentServiceConfig = async ({
239
178
  t,
240
- setError,
241
- dbVolSizeGiB,
242
- fsVolSizeGiB,
243
- imgVolSizeGiB,
244
- ciscoIntersightURL,
179
+ values,
245
180
  }: {
246
181
  t: TFunction;
247
- setError: SetErrorFuncType;
248
-
249
- dbVolSizeGiB: number;
250
- fsVolSizeGiB: number;
251
- imgVolSizeGiB: number;
252
- ciscoIntersightURL?: string;
253
- }): Promise<boolean> => {
182
+ values: CimConfigurationValues;
183
+ }) => {
254
184
  try {
255
185
  const agentServiceConfig = {
256
186
  apiVersion: 'agent-install.openshift.io/v1beta1',
@@ -264,7 +194,7 @@ const createAgentServiceConfig = async ({
264
194
  accessModes: ['ReadWriteOnce'],
265
195
  resources: {
266
196
  requests: {
267
- storage: `${dbVolSizeGiB}Gi`,
197
+ storage: `${values.dbVolSize}Gi`,
268
198
  },
269
199
  },
270
200
  },
@@ -272,7 +202,7 @@ const createAgentServiceConfig = async ({
272
202
  accessModes: ['ReadWriteOnce'],
273
203
  resources: {
274
204
  requests: {
275
- storage: `${fsVolSizeGiB}Gi`,
205
+ storage: `${values.fsVolSize}Gi`,
276
206
  },
277
207
  },
278
208
  },
@@ -280,17 +210,17 @@ const createAgentServiceConfig = async ({
280
210
  accessModes: ['ReadWriteOnce'],
281
211
  resources: {
282
212
  requests: {
283
- storage: `${imgVolSizeGiB}Gi`,
213
+ storage: `${values.imgVolSize}Gi`,
284
214
  },
285
215
  },
286
216
  },
287
217
  },
288
218
  };
289
219
 
290
- if (ciscoIntersightURL) {
220
+ if (values.ciscoIntersightURL) {
291
221
  agentServiceConfig.metadata = {
292
222
  ...agentServiceConfig.metadata,
293
- annotations: { ciscoIntersightURL },
223
+ annotations: { ciscoIntersightURL: values.ciscoIntersightURL },
294
224
  };
295
225
  }
296
226
 
@@ -298,99 +228,67 @@ const createAgentServiceConfig = async ({
298
228
  model: AgentServiceConfigModel,
299
229
  data: agentServiceConfig,
300
230
  });
301
-
302
- return true;
303
231
  } catch (e) {
304
- setError({
305
- title: t('ai:Failed to create AgentServiceConfig'),
306
- message: getErrorMessage(e),
307
- });
308
- return false;
232
+ throw new Error(`${t('ai:Failed to create AgentServiceConfig')}: ${getErrorMessage(e)}`);
309
233
  }
310
234
  };
311
235
 
312
- // https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.6/html/multicluster_engine/multicluster_engine_overview#enable-cim
313
- export const onEnableCIM = async ({
236
+ export const editAgentServiceConfig = async ({
314
237
  t,
315
- setError,
316
-
317
238
  agentServiceConfig,
318
- platform,
319
-
320
- dbVolSizeGiB,
321
- fsVolSizeGiB,
322
- imgVolSizeGiB,
323
-
324
- configureLoadBalancer,
325
- ciscoIntersightURL,
239
+ values,
326
240
  }: {
327
241
  t: TFunction;
328
- setError: SetErrorFuncType;
329
-
330
- agentServiceConfig?: AgentServiceConfigK8sResource;
331
- platform: string;
332
-
333
- dbVolSizeGiB: number;
334
- fsVolSizeGiB: number;
335
- imgVolSizeGiB: number;
336
-
337
- configureLoadBalancer: boolean;
338
- ciscoIntersightURL?: string;
242
+ agentServiceConfig: AgentServiceConfigK8sResource;
243
+ values: CimConfigurationValues;
339
244
  }) => {
340
- if (['none', 'baremetal', 'openstack', 'vsphere'].includes(platform.toLocaleLowerCase())) {
341
- await patchProvisioningConfiguration({ t, setError });
342
- }
343
-
344
- if (!agentServiceConfig) {
345
- if (
346
- !(await createAgentServiceConfig({
347
- t,
348
- setError,
349
- dbVolSizeGiB,
350
- fsVolSizeGiB,
351
- imgVolSizeGiB,
352
- ciscoIntersightURL,
353
- }))
354
- ) {
355
- return false;
356
- }
357
- } else {
358
- const patches = [] as K8sPatch;
245
+ const patches: Patch[] = [];
246
+
247
+ if (
248
+ agentServiceConfig.metadata?.annotations?.['ciscoIntersightURL'] &&
249
+ !values.ciscoIntersightURL
250
+ ) {
251
+ patches.push({
252
+ op: 'remove',
253
+ path: '/metadata/annotations/ciscoIntersightURL',
254
+ });
255
+ } else if (!agentServiceConfig.metadata?.annotations && values.ciscoIntersightURL) {
256
+ patches.push({
257
+ op: 'add',
258
+ path: '/metadata/annotations',
259
+ value: { ciscoIntersightURL: values.ciscoIntersightURL },
260
+ });
261
+ } else if (values.ciscoIntersightURL) {
359
262
  appendPatch(
360
263
  patches,
361
264
  '/metadata/annotations/ciscoIntersightURL',
362
- ciscoIntersightURL,
265
+ values.ciscoIntersightURL,
363
266
  agentServiceConfig.metadata?.annotations?.['ciscoIntersightURL'],
364
267
  );
365
- await k8sPatch({ model: AgentServiceConfigModel, resource: agentServiceConfig, data: patches });
366
268
  }
367
269
 
368
- // see isCIMConfigProgressing()
369
- window.localStorage.setItem(LOCAL_STORAGE_ID_LAST_UPDATE_TIMESTAMP, new Date().toISOString());
370
-
371
- if (configureLoadBalancer) {
372
- // Recently No to Yes only (since we do not delete the ingress controller)
373
- if (await isIngressController()) {
374
- return true /* Not an error */;
375
- }
376
-
377
- const assistedImageServiceRoute = await getAssistedImageServiceRoute(t, setError);
378
- if (!assistedImageServiceRoute) {
379
- return false;
380
- }
270
+ if (patches.length === 0) {
271
+ return;
272
+ }
381
273
 
382
- const domain = getClusterDomain(t, setError, assistedImageServiceRoute);
383
- if (!domain) {
384
- return false;
385
- }
274
+ try {
275
+ await k8sPatch({
276
+ model: AgentServiceConfigModel,
277
+ resource: agentServiceConfig,
278
+ data: patches,
279
+ });
280
+ } catch (e) {
281
+ throw new Error(`${t('ai:Failed to save configuration')}: ${getErrorMessage(e)}`);
282
+ }
283
+ };
386
284
 
387
- if (
388
- !(await createIngressController(t, setError, domain)) ||
389
- !(await patchAssistedImageServiceRoute(t, setError, assistedImageServiceRoute, domain))
390
- ) {
391
- return false;
392
- }
285
+ export const configureIngressLoadBalancer = async ({ t }: { t: TFunction }) => {
286
+ if (await isIngressController()) {
287
+ return;
393
288
  }
394
289
 
395
- return true;
290
+ const assistedImageServiceRoute = await getAssistedImageServiceRoute(t);
291
+ const domain = getClusterDomain(t, assistedImageServiceRoute);
292
+ await createIngressController(t, domain);
293
+ await patchAssistedImageServiceRoute(t, assistedImageServiceRoute, domain);
396
294
  };
@@ -56,7 +56,7 @@ export type AgentClusterInstallK8sResource = K8sResourceCommon & {
56
56
  cidr: string;
57
57
  }[];
58
58
  userManagedNetworking?: boolean;
59
- networkType?: 'OpenShiftSDN' | 'OVNKubernetes';
59
+ networkType?: 'OpenShiftSDN' | 'OVNKubernetes' | 'CiscoACI' | 'Cilium' | 'Calico' | 'None';
60
60
  };
61
61
  holdInstallation?: boolean;
62
62
  platformType: string;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { Alert, AlertVariant, Stack, StackItem } from '@patternfly/react-core';
3
+ import { useTranslation } from '../../../hooks';
4
+
5
+ export const CustomManifestsAlert = ({
6
+ usesExternalPlatform,
7
+ usesThirdPartyCNI,
8
+ }: {
9
+ usesExternalPlatform: boolean;
10
+ usesThirdPartyCNI: boolean;
11
+ }) => {
12
+ const { t } = useTranslation();
13
+
14
+ let title: string;
15
+ let body: string;
16
+
17
+ if (usesExternalPlatform && usesExternalPlatform) {
18
+ title = t("ai:You're using an external platform and a third-party CNI");
19
+ body = t('ai:Make sure to upload the required custom and CNI manifests in this step.');
20
+ } else if (usesExternalPlatform) {
21
+ title = t("ai:You're using an external platform");
22
+ body = t('ai:Make sure to upload the required custom manifests in this step.');
23
+ } else if (usesThirdPartyCNI) {
24
+ title = t("ai:You're using a third-party CNI");
25
+ body = t('ai:Make sure to upload the required CNI manifests in this step.');
26
+ } else {
27
+ return null;
28
+ }
29
+
30
+ return (
31
+ <Stack>
32
+ <StackItem>
33
+ <Alert variant={AlertVariant.info} isInline title={title}>
34
+ {body}
35
+ </Alert>
36
+ </StackItem>
37
+ </Stack>
38
+ );
39
+ };
@@ -0,0 +1 @@
1
+ export * from './CustomManifestsAlert';
@@ -7,3 +7,5 @@ export { ClusterValidations, HostsValidations } from './ReviewValidations';
7
7
  export * from './clusterDetailsValidation';
8
8
  export * from './types';
9
9
  export * from './validationsInfoUtils';
10
+ export * from './customManifests';
11
+ export * from './networkingSteps';
@@ -59,6 +59,7 @@ export interface AvailableSubnetsControlProps {
59
59
  isViewerMode?: boolean;
60
60
  hosts?: Host[];
61
61
  isMultiNodeCluster?: boolean;
62
+ allowSingleStackIPv6?: boolean;
62
63
  }
63
64
 
64
65
  export const AvailableSubnetsControl = ({
@@ -70,6 +71,7 @@ export const AvailableSubnetsControl = ({
70
71
  isViewerMode = false,
71
72
  hosts,
72
73
  isMultiNodeCluster = true,
74
+ allowSingleStackIPv6 = false,
73
75
  }: AvailableSubnetsControlProps) => {
74
76
  const { t } = useTranslation();
75
77
  const { values, errors, setFieldValue } = useFormikContext<NetworkConfigurationValues>();
@@ -207,7 +209,12 @@ export const AvailableSubnetsControl = ({
207
209
  isDualStack && values.machineNetworks && values.machineNetworks.length > 1;
208
210
 
209
211
  // Determine available subnets for primary dropdown
210
- const primaryMachineSubnets = isDualStack && supportsIPv6Primary ? allSubnets : IPv4Subnets;
212
+ let primaryMachineSubnets: HostSubnet[];
213
+ if ((isDualStack && supportsIPv6Primary) || (!isDualStack && allowSingleStackIPv6)) {
214
+ primaryMachineSubnets = allSubnets;
215
+ } else {
216
+ primaryMachineSubnets = IPv4Subnets;
217
+ }
211
218
 
212
219
  // Determine available subnets for secondary dropdown
213
220
  const secondaryMachineSubnets = React.useMemo(() => {
@@ -55,10 +55,10 @@ export const ManagedNetworkingControlGroup = ({
55
55
  value={'userManaged'}
56
56
  label={
57
57
  <>
58
- <span>{t('ai:User-Managed Networking')}</span>{' '}
58
+ <span>{t('ai:User-Managed networking')}</span>{' '}
59
59
  <PopoverIcon
60
60
  bodyContent={t(
61
- "ai:With User-Managed Networking, you'll need to provide and configure a load balancer for the API and ingress endpoints.",
61
+ "ai:With User-Managed networking, you'll need to provide and configure a load balancer for the API and ingress endpoints.",
62
62
  )}
63
63
  />
64
64
  </>
@@ -10,9 +10,10 @@ import {
10
10
  NETWORK_TYPE_SDN,
11
11
  } from '../../../types';
12
12
  import { getFieldId } from '../../ui';
13
- import { DUAL_STACK, IPV4_STACK, NO_SUBNET_SET } from '../../../config';
13
+ import { DUAL_STACK, NO_SUBNET_SET, SINGLE_STACK } from '../../../config';
14
14
  import { RadioField } from '../../ui/formik';
15
15
  import { ConfirmationModal, PopoverIcon } from '../../ui';
16
+ import { useTranslation } from '../../../hooks/use-translation-wrapper';
16
17
  import { reorderNetworksByCurrentPrimary } from './reorderNetworks';
17
18
  import {
18
19
  Cluster,
@@ -36,6 +37,7 @@ export type StackTypeControlGroupProps = {
36
37
  hostSubnets: HostSubnets;
37
38
  defaultNetworkValues: StackTypeDefaultNetworkValues;
38
39
  isViewerMode?: boolean;
40
+ allowSingleStackIPv6?: boolean;
39
41
  };
40
42
 
41
43
  const hasDualStackConfigurationChanged = (
@@ -60,17 +62,21 @@ export const StackTypeControlGroup = ({
60
62
  hostSubnets,
61
63
  defaultNetworkValues,
62
64
  isViewerMode = false,
65
+ allowSingleStackIPv6 = false,
63
66
  }: StackTypeControlGroupProps) => {
67
+ const { t } = useTranslation();
64
68
  const { setFieldValue, values, validateForm } = useFormikContext<NetworkConfigurationValues>();
65
69
  const [openConfirmModal, setConfirmModal] = React.useState(false);
66
70
 
71
+ const singleStackLabel = allowSingleStackIPv6 ? t('ai:Single stack') : t('ai:IPv4');
72
+
67
73
  const IPv6Subnets = hostSubnets.filter((subnet) => Address6.isValid(subnet.subnet));
68
74
  const cidrIPv6 = IPv6Subnets.length >= 1 ? IPv6Subnets[0].subnet : NO_SUBNET_SET;
69
75
  const shouldSetSingleStack =
70
76
  !isViewerMode && !isDualStackSelectable && values.stackType === DUAL_STACK;
71
77
 
72
78
  const setSingleStack = React.useCallback(() => {
73
- setFieldValue('stackType', IPV4_STACK);
79
+ setFieldValue('stackType', SINGLE_STACK);
74
80
 
75
81
  // Determine whether the first machine network is IPv4
76
82
  const firstNetwork = values.machineNetworks?.[0];
@@ -94,7 +100,8 @@ export const StackTypeControlGroup = ({
94
100
  }
95
101
  }
96
102
  }
97
- // Ensure single-stack inputs are IPv4 after switching from dual-stack
103
+
104
+ // Set cluster/service to IPv4 defaults when switching to single-stack
98
105
  if (values.clusterNetworks && values.clusterNetworks.length >= 1) {
99
106
  const defaultCluster =
100
107
  defaultNetworkValues.clusterNetworksIpv4 && defaultNetworkValues.clusterNetworksIpv4[0];
@@ -196,28 +203,27 @@ export const StackTypeControlGroup = ({
196
203
  }
197
204
  }
198
205
  if (values.clusterNetworks && values.clusterNetworks?.length < 2) {
199
- setFieldValue(
200
- 'clusterNetworks',
201
- [
202
- ...values.clusterNetworks,
203
- defaultNetworkValues.clusterNetworksDualstack?.length
204
- ? defaultNetworkValues.clusterNetworksDualstack[1]
205
- : { cidr: '', hostPrefix: '', clusterId: clusterId },
206
- ],
207
- false,
208
- );
206
+ const firstClusterCidr = values.clusterNetworks[0]?.cidr;
207
+ const isPrimaryIPv6 = firstClusterCidr && Address6.isValid(firstClusterCidr);
208
+ const missingFamilyNetworkDefault =
209
+ defaultNetworkValues.clusterNetworksDualstack?.[isPrimaryIPv6 ? 0 : 1];
210
+ const secondClusterNetwork = missingFamilyNetworkDefault ?? {
211
+ cidr: '',
212
+ hostPrefix: '',
213
+ clusterId: clusterId,
214
+ };
215
+ setFieldValue('clusterNetworks', [...values.clusterNetworks, secondClusterNetwork], false);
209
216
  }
210
217
  if (values.serviceNetworks && values.serviceNetworks?.length < 2) {
211
- setFieldValue(
212
- 'serviceNetworks',
213
- [
214
- ...values.serviceNetworks,
215
- defaultNetworkValues.serviceNetworksDualstack?.length
216
- ? defaultNetworkValues.serviceNetworksDualstack[1]
217
- : { cidr: '', clusterId: clusterId },
218
- ],
219
- false,
220
- );
218
+ const firstServiceCidr = values.serviceNetworks[0]?.cidr;
219
+ const isPrimaryIPv6 = firstServiceCidr && Address6.isValid(firstServiceCidr);
220
+ const missingFamilyNetworkDefault =
221
+ defaultNetworkValues.serviceNetworksDualstack?.[isPrimaryIPv6 ? 0 : 1];
222
+ const secondServiceNetwork = missingFamilyNetworkDefault ?? {
223
+ cidr: '',
224
+ clusterId: clusterId,
225
+ };
226
+ setFieldValue('serviceNetworks', [...values.serviceNetworks, secondServiceNetwork], false);
221
227
  }
222
228
  // Initialize VIPs for dual-stack
223
229
  if (values.apiVips && values.apiVips.length < 2) {
@@ -290,14 +296,18 @@ export const StackTypeControlGroup = ({
290
296
  <SplitItem>
291
297
  <RadioField
292
298
  name={'stackType'}
293
- value={IPV4_STACK}
299
+ value={SINGLE_STACK}
294
300
  isDisabled={!isDualStackSelectable || isViewerMode}
295
- label="IPv4&nbsp;"
301
+ label={`${singleStackLabel}\u00A0`}
296
302
  />
297
303
  </SplitItem>
298
304
  <SplitItem>
299
305
  <PopoverIcon
300
- bodyContent="Select this when your hosts are using only IPv4."
306
+ bodyContent={
307
+ allowSingleStackIPv6
308
+ ? t('ai:Select a single address family (IPv4 or IPv6) for your machine network.')
309
+ : t('ai:Select this when your hosts are using only IPv4.')
310
+ }
301
311
  buttonStyle={{ top: '-4px' }}
302
312
  />
303
313
  </SplitItem>