@openshift-assisted/ui-lib 2.18.0-cim → 2.18.1-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 (74) 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/networkConfigurationValidation.d.ts +1 -1
  4. package/build/@types/cim/components/ClusterDeployment/networkConfigurationValidation.d.ts.map +1 -1
  5. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts +4 -4
  6. package/build/@types/cim/components/ClusterDeployment/use-networking-formik.d.ts.map +1 -1
  7. package/build/@types/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.d.ts.map +1 -1
  8. package/build/@types/cim/components/helpers/versions.d.ts +2 -2
  9. package/build/@types/cim/components/helpers/versions.d.ts.map +1 -1
  10. package/build/@types/cim/components/helpers/versions.test.d.ts +2 -0
  11. package/build/@types/cim/components/helpers/versions.test.d.ts.map +1 -0
  12. package/build/@types/cim/components/modals/CimConfiguration/CimConfigurationModal.d.ts.map +1 -1
  13. package/build/@types/cim/components/modals/CimConfiguration/persist.d.ts +14 -17
  14. package/build/@types/cim/components/modals/CimConfiguration/persist.d.ts.map +1 -1
  15. package/build/@types/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.d.ts +2 -1
  16. package/build/@types/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.d.ts.map +1 -1
  17. package/build/@types/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.d.ts +2 -1
  18. package/build/@types/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.d.ts.map +1 -1
  19. package/build/@types/common/components/ui/formik/utils.d.ts +1 -0
  20. package/build/@types/common/components/ui/formik/utils.d.ts.map +1 -1
  21. package/build/@types/common/config/constants.d.ts +2 -2
  22. package/build/@types/common/config/constants.d.ts.map +1 -1
  23. package/build/@types/common/validationSchemas/networkingValidation.d.ts +10 -0
  24. package/build/@types/common/validationSchemas/networkingValidation.d.ts.map +1 -1
  25. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.d.ts.map +1 -1
  26. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js +44 -5
  27. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js.map +1 -1
  28. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js +25 -9
  29. package/build/cjs/cim/components/ClusterDeployment/networkConfigurationValidation.js.map +1 -1
  30. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js +13 -18
  31. package/build/cjs/cim/components/ClusterDeployment/use-networking-formik.js.map +1 -1
  32. package/build/cjs/cim/components/Hypershift/modals/NodePoolForm.js +1 -1
  33. package/build/cjs/cim/components/Hypershift/modals/NodePoolForm.js.map +1 -1
  34. package/build/cjs/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.js +1 -4
  35. package/build/cjs/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.js.map +1 -1
  36. package/build/cjs/cim/components/helpers/versions.js +39 -28
  37. package/build/cjs/cim/components/helpers/versions.js.map +1 -1
  38. package/build/cjs/cim/components/helpers/versions.test.js +423 -0
  39. package/build/cjs/cim/components/helpers/versions.test.js.map +1 -0
  40. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigurationModal.js +39 -16
  41. package/build/cjs/cim/components/modals/CimConfiguration/CimConfigurationModal.js.map +1 -1
  42. package/build/cjs/cim/components/modals/CimConfiguration/persist.js +95 -135
  43. package/build/cjs/cim/components/modals/CimConfiguration/persist.js.map +1 -1
  44. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js +8 -2
  45. package/build/cjs/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.js.map +1 -1
  46. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js +29 -19
  47. package/build/cjs/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.js.map +1 -1
  48. package/build/cjs/common/components/ui/formik/utils.js +5 -1
  49. package/build/cjs/common/components/ui/formik/utils.js.map +1 -1
  50. package/build/cjs/common/config/constants.js +9 -2
  51. package/build/cjs/common/config/constants.js.map +1 -1
  52. package/build/cjs/common/validationSchemas/networkingValidation.js +19 -1
  53. package/build/cjs/common/validationSchemas/networkingValidation.js.map +1 -1
  54. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js +1 -1
  55. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.js.map +1 -1
  56. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js +4 -4
  57. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.js.map +1 -1
  58. package/lib/cim/components/ClusterDeployment/NetworkConfiguration.tsx +51 -3
  59. package/lib/cim/components/ClusterDeployment/networkConfigurationValidation.ts +22 -8
  60. package/lib/cim/components/ClusterDeployment/use-networking-formik.ts +14 -22
  61. package/lib/cim/components/Hypershift/modals/NodePoolForm.tsx +2 -2
  62. package/lib/cim/components/featureSupportLevels/ACMFeatureSupportLevelProvider.tsx +2 -5
  63. package/lib/cim/components/helpers/versions.test.ts +465 -0
  64. package/lib/cim/components/helpers/versions.ts +37 -31
  65. package/lib/cim/components/modals/CimConfiguration/CimConfigurationModal.tsx +45 -18
  66. package/lib/cim/components/modals/CimConfiguration/persist.ts +97 -199
  67. package/lib/common/components/clusterWizard/networkingSteps/AvailableSubnetsControl.tsx +8 -1
  68. package/lib/common/components/clusterWizard/networkingSteps/StackTypeControlGroup.tsx +36 -26
  69. package/lib/common/components/ui/formik/utils.ts +6 -0
  70. package/lib/common/config/constants.ts +10 -1
  71. package/lib/common/validationSchemas/networkingValidation.tsx +39 -1
  72. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkConfigurationForm.tsx +2 -2
  73. package/lib/ocm/components/clusterConfiguration/networkConfiguration/networkConfigurationValidation.ts +6 -5
  74. package/package.json +3 -3
@@ -126,6 +126,12 @@ export const allSubnetsIPv4 = (
126
126
  return !!networks?.every((network) => network.cidr && Address4.isValid(network.cidr));
127
127
  };
128
128
 
129
+ export const allSubnetsIPv6 = (
130
+ networks: (MachineNetwork | ClusterNetwork | ServiceNetwork)[] | undefined,
131
+ ) => {
132
+ return !!networks?.every((network) => network.cidr && Address6.isValid(network.cidr));
133
+ };
134
+
129
135
  export const labelsToArray = (labels: { [key in string]: string } = {}): string[] => {
130
136
  const result: string[] = [];
131
137
  for (const key in labels) {
@@ -289,8 +289,10 @@ export const CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV6 = {
289
289
  export const CLUSTER_DEFAULT_NETWORK_SETTINGS: Pick<
290
290
  ClusterDefaultConfig,
291
291
  | 'clusterNetworksIpv4'
292
+ | 'clusterNetworksIpv6'
292
293
  | 'clusterNetworksDualstack'
293
294
  | 'serviceNetworksIpv4'
295
+ | 'serviceNetworksIpv6'
294
296
  | 'serviceNetworksDualstack'
295
297
  > = {
296
298
  clusterNetworksIpv4: [
@@ -299,6 +301,12 @@ export const CLUSTER_DEFAULT_NETWORK_SETTINGS: Pick<
299
301
  hostPrefix: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4.clusterNetworkHostPrefix,
300
302
  },
301
303
  ],
304
+ clusterNetworksIpv6: [
305
+ {
306
+ cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV6.clusterNetworkCidr,
307
+ hostPrefix: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV6.clusterNetworkHostPrefix,
308
+ },
309
+ ],
302
310
  clusterNetworksDualstack: [
303
311
  {
304
312
  cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4.clusterNetworkCidr,
@@ -310,6 +318,7 @@ export const CLUSTER_DEFAULT_NETWORK_SETTINGS: Pick<
310
318
  },
311
319
  ],
312
320
  serviceNetworksIpv4: [{ cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4.serviceNetworkCidr }],
321
+ serviceNetworksIpv6: [{ cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV6.serviceNetworkCidr }],
313
322
  serviceNetworksDualstack: [
314
323
  { cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4.serviceNetworkCidr },
315
324
  { cidr: CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV6.serviceNetworkCidr },
@@ -333,7 +342,7 @@ export const MS_PER_DAY = 1000 * 60 * 60 * 24;
333
342
 
334
343
  export const NO_SUBNET_SET = 'NO_SUBNET_SET';
335
344
 
336
- export const IPV4_STACK = 'singleStack';
345
+ export const SINGLE_STACK = 'singleStack';
337
346
  export const DUAL_STACK = 'dualStack';
338
347
 
339
348
  export const PREFIX_MAX_RESTRICTION = {
@@ -13,7 +13,8 @@ import {
13
13
  ipBlockValidationSchema,
14
14
  } from './addressValidation';
15
15
  import { isMajorMinorVersionEqualOrGreater } from '../utils';
16
- import { allSubnetsIPv4 } from '../components/ui/formik/utils';
16
+ import { allSubnetsIPv4, allSubnetsIPv6 } from '../components/ui/formik/utils';
17
+ import { SINGLE_STACK } from '../config';
17
18
 
18
19
  export const machineNetworksValidationSchema = Yup.array().of(
19
20
  Yup.object({ cidr: hostSubnetValidationSchema, clusterId: Yup.string() }),
@@ -111,3 +112,40 @@ export const IPv4ValidationSchema = Yup.array().test(
111
112
  `All network subnets must be IPv4.`,
112
113
  (values?: (MachineNetwork | ClusterNetwork | ServiceNetwork)[]) => allSubnetsIPv4(values),
113
114
  );
115
+
116
+ export const IPv6ValidationSchema = Yup.array().test(
117
+ 'single-stack-ipv6',
118
+ 'All network subnets must be IPv6.',
119
+ (values?: (MachineNetwork | ClusterNetwork | ServiceNetwork)[]) => allSubnetsIPv6(values),
120
+ );
121
+
122
+ export const clusterNetworksSchema = (
123
+ t: TFunction,
124
+ stackType: string,
125
+ primaryCidr: string | undefined,
126
+ openshiftVersion?: string,
127
+ ) => {
128
+ const singleStackFamilySchema =
129
+ primaryCidr && isCIDR.v6(primaryCidr) ? IPv6ValidationSchema : IPv4ValidationSchema;
130
+
131
+ const stackFamilySchema =
132
+ stackType === SINGLE_STACK
133
+ ? singleStackFamilySchema
134
+ : dualStackValidationSchema(t('ai:cluster network'), t, openshiftVersion);
135
+ return clusterNetworksValidationSchema(t).concat(stackFamilySchema);
136
+ };
137
+
138
+ export const serviceNetworksSchema = (
139
+ t: TFunction,
140
+ stackType: string,
141
+ primaryCidr: string | undefined,
142
+ openshiftVersion?: string,
143
+ ) => {
144
+ const singleStackFamilySchema =
145
+ primaryCidr && isCIDR.v6(primaryCidr) ? IPv6ValidationSchema : IPv4ValidationSchema;
146
+ const stackFamilySchema =
147
+ stackType === SINGLE_STACK
148
+ ? singleStackFamilySchema
149
+ : dualStackValidationSchema(t('ai:service network'), t, openshiftVersion);
150
+ return serviceNetworkValidationSchema(t).concat(stackFamilySchema);
151
+ };
@@ -9,7 +9,7 @@ import {
9
9
  getFormikErrorFields,
10
10
  getHostSubnets,
11
11
  HostSubnets,
12
- IPV4_STACK,
12
+ SINGLE_STACK,
13
13
  isSNO,
14
14
  LoadingState,
15
15
  NetworkConfigurationValues,
@@ -262,7 +262,7 @@ const NetworkConfigurationPage = ({ cluster }: { cluster: Cluster }) => {
262
262
  if (values.vipDhcpAllocation) {
263
263
  delete params.apiVips;
264
264
  delete params.ingressVips;
265
- } else if (values.stackType === IPV4_STACK) {
265
+ } else if (values.stackType === SINGLE_STACK) {
266
266
  // The API will rebuild the default machineNetwork
267
267
  params.machineNetworks = [];
268
268
  }
@@ -11,7 +11,7 @@ import {
11
11
  serviceNetworkValidationSchema,
12
12
  IPv4ValidationSchema,
13
13
  sshPublicKeyValidationSchema,
14
- IPV4_STACK,
14
+ SINGLE_STACK,
15
15
  DUAL_STACK,
16
16
  vipArrayValidationSchema,
17
17
  NETWORK_TYPE_OVN,
@@ -50,7 +50,7 @@ export const getNetworkInitialValues = (
50
50
  : 'clusterManaged',
51
51
  networkType: cluster.networkType || NETWORK_TYPE_OVN,
52
52
  machineNetworks: cluster.machineNetworks || [],
53
- stackType: isDualStackType ? DUAL_STACK : IPV4_STACK,
53
+ stackType: isDualStackType ? DUAL_STACK : SINGLE_STACK,
54
54
  clusterNetworks:
55
55
  cluster.clusterNetworks ||
56
56
  (isDualStackType
@@ -85,7 +85,8 @@ export const getNetworkConfigurationValidationSchema = (
85
85
  values.managedNetworkingType === 'userManaged'
86
86
  ? Yup.array()
87
87
  : machineNetworksValidationSchema.when('stackType', {
88
- is: (stackType: NetworkConfigurationValues['stackType']) => stackType === IPV4_STACK,
88
+ is: (stackType: NetworkConfigurationValues['stackType']) =>
89
+ stackType === SINGLE_STACK,
89
90
  then: () => machineNetworksValidationSchema.concat(IPv4ValidationSchema),
90
91
  otherwise: () =>
91
92
  values.machineNetworks && values.machineNetworks?.length >= 2
@@ -95,13 +96,13 @@ export const getNetworkConfigurationValidationSchema = (
95
96
  : Yup.array(),
96
97
  }),
97
98
  clusterNetworks: clusterNetworksValidationSchema(t).when('stackType', {
98
- is: (stackType: NetworkConfigurationValues['stackType']) => stackType === IPV4_STACK,
99
+ is: (stackType: NetworkConfigurationValues['stackType']) => stackType === SINGLE_STACK,
99
100
  then: (schema) => schema.concat(IPv4ValidationSchema),
100
101
  otherwise: (schema) =>
101
102
  schema.concat(dualStackValidationSchema('cluster network', t, openshiftVersion)),
102
103
  }),
103
104
  serviceNetworks: serviceNetworkValidationSchema(t).when('stackType', {
104
- is: (stackType: NetworkConfigurationValues['stackType']) => stackType === IPV4_STACK,
105
+ is: (stackType: NetworkConfigurationValues['stackType']) => stackType === SINGLE_STACK,
105
106
  then: (schema) => schema.concat(IPv4ValidationSchema),
106
107
  otherwise: (schema) =>
107
108
  schema.concat(dualStackValidationSchema('service network', t, openshiftVersion)),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
- "@openshift-assisted/locales": "2.18.0-cim",
4
- "@openshift-assisted/types": "2.18.0-cim",
3
+ "@openshift-assisted/locales": "2.18.1-cim",
4
+ "@openshift-assisted/types": "2.18.1-cim",
5
5
  "@openshift-console/dynamic-plugin-sdk": "^4.19.1",
6
6
  "@patternfly/patternfly": "6.4.0",
7
7
  "@patternfly/react-code-editor": "6.4.1",
@@ -136,5 +136,5 @@
136
136
  ]
137
137
  }
138
138
  },
139
- "version": "2.18.0-cim"
139
+ "version": "2.18.1-cim"
140
140
  }