@openshift-assisted/ui-lib 2.18.1-cim → 2.18.3-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 (99) hide show
  1. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizard.d.ts +1 -1
  2. package/build/@types/cim/components/ClusterDeployment/ClusterDeploymentWizard.d.ts.map +1 -1
  3. package/build/@types/cim/components/ClusterDeployment/NetworkConfiguration.d.ts.map +1 -1
  4. package/build/@types/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.d.ts.map +1 -1
  5. package/build/@types/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.d.ts +5 -0
  6. package/build/@types/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.d.ts.map +1 -0
  7. package/build/@types/cim/components/ClusterDeployment/review/ClusterDeploymentReviewStep.d.ts.map +1 -1
  8. package/build/@types/cim/components/ClusterDeployment/types.d.ts +0 -1
  9. package/build/@types/cim/components/ClusterDeployment/types.d.ts.map +1 -1
  10. package/build/@types/cim/components/ClusterDeployment/wizardTransition.d.ts.map +1 -1
  11. package/build/@types/cim/components/helpers/clusterDeployment.d.ts.map +1 -1
  12. package/build/@types/cim/hooks/index.d.ts +1 -0
  13. package/build/@types/cim/hooks/index.d.ts.map +1 -1
  14. package/build/@types/cim/hooks/useAgents.d.ts +4 -0
  15. package/build/@types/cim/hooks/useAgents.d.ts.map +1 -0
  16. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts +1 -1
  17. package/build/@types/cim/types/k8s/agent-cluster-install.d.ts.map +1 -1
  18. package/build/@types/common/components/clusterWizard/customManifests/CustomManifestsAlert.d.ts +6 -0
  19. package/build/@types/common/components/clusterWizard/customManifests/CustomManifestsAlert.d.ts.map +1 -0
  20. package/build/@types/common/components/clusterWizard/customManifests/index.d.ts +2 -0
  21. package/build/@types/common/components/clusterWizard/customManifests/index.d.ts.map +1 -0
  22. package/build/@types/common/components/clusterWizard/index.d.ts +2 -0
  23. package/build/@types/common/components/clusterWizard/index.d.ts.map +1 -1
  24. package/build/@types/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.d.ts +3 -0
  25. package/build/@types/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.d.ts.map +1 -0
  26. package/build/@types/common/components/clusterWizard/networkingSteps/index.d.ts +1 -0
  27. package/build/@types/common/components/clusterWizard/networkingSteps/index.d.ts.map +1 -1
  28. package/build/@types/common/types/networkType.d.ts +2 -1
  29. package/build/@types/common/types/networkType.d.ts.map +1 -1
  30. package/build/@types/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.d.ts.map +1 -1
  31. package/build/@types/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.d.ts.map +1 -1
  32. package/build/@types/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.d.ts.map +1 -1
  33. package/build/@types/ocm/components/clusterDetail/ClusterProperties.d.ts +2 -1
  34. package/build/@types/ocm/components/clusterDetail/ClusterProperties.d.ts.map +1 -1
  35. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js +9 -1
  36. package/build/cjs/cim/components/ClusterDeployment/ClusterDeploymentWizard.js.map +1 -1
  37. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js +2 -2
  38. package/build/cjs/cim/components/ClusterDeployment/NetworkConfiguration.js.map +1 -1
  39. package/build/cjs/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.js +24 -23
  40. package/build/cjs/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.js.map +1 -1
  41. package/build/cjs/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.js +35 -0
  42. package/build/cjs/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.js.map +1 -0
  43. package/build/cjs/cim/components/ClusterDeployment/review/ClusterDeploymentReviewStep.js +4 -4
  44. package/build/cjs/cim/components/ClusterDeployment/review/ClusterDeploymentReviewStep.js.map +1 -1
  45. package/build/cjs/cim/components/ClusterDeployment/wizardTransition.js +5 -1
  46. package/build/cjs/cim/components/ClusterDeployment/wizardTransition.js.map +1 -1
  47. package/build/cjs/cim/components/helpers/clusterDeployment.js +14 -10
  48. package/build/cjs/cim/components/helpers/clusterDeployment.js.map +1 -1
  49. package/build/cjs/cim/hooks/index.js +1 -0
  50. package/build/cjs/cim/hooks/index.js.map +1 -1
  51. package/build/cjs/cim/hooks/useAgents.js +13 -0
  52. package/build/cjs/cim/hooks/useAgents.js.map +1 -0
  53. package/build/cjs/common/components/clusterWizard/customManifests/CustomManifestsAlert.js +32 -0
  54. package/build/cjs/common/components/clusterWizard/customManifests/CustomManifestsAlert.js.map +1 -0
  55. package/build/cjs/common/components/clusterWizard/customManifests/index.js +5 -0
  56. package/build/cjs/common/components/clusterWizard/customManifests/index.js.map +1 -0
  57. package/build/cjs/common/components/clusterWizard/index.js +2 -0
  58. package/build/cjs/common/components/clusterWizard/index.js.map +1 -1
  59. package/build/cjs/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.js +20 -0
  60. package/build/cjs/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.js.map +1 -0
  61. package/build/cjs/common/components/clusterWizard/networkingSteps/index.js +3 -4
  62. package/build/cjs/common/components/clusterWizard/networkingSteps/index.js.map +1 -1
  63. package/build/cjs/common/types/networkType.js +9 -8
  64. package/build/cjs/common/types/networkType.js.map +1 -1
  65. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js +1 -20
  66. package/build/cjs/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.js.map +1 -1
  67. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js +6 -9
  68. package/build/cjs/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.js.map +1 -1
  69. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.js +3 -2
  70. package/build/cjs/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.js.map +1 -1
  71. package/build/cjs/ocm/components/clusterDetail/ClusterProperties.js +3 -3
  72. package/build/cjs/ocm/components/clusterDetail/ClusterProperties.js.map +1 -1
  73. package/lib/cim/components/ClusterDeployment/ClusterDeploymentWizard.tsx +10 -2
  74. package/lib/cim/components/ClusterDeployment/NetworkConfiguration.tsx +4 -3
  75. package/lib/cim/components/ClusterDeployment/customManifests/ClusterDeploymentCustomManifestsStep.tsx +18 -2
  76. package/lib/cim/components/ClusterDeployment/networking/NetworkTypeDropdown.tsx +81 -0
  77. package/lib/cim/components/ClusterDeployment/review/ClusterDeploymentReviewStep.tsx +18 -14
  78. package/lib/cim/components/ClusterDeployment/types.ts +0 -1
  79. package/lib/cim/components/ClusterDeployment/wizardTransition.ts +5 -1
  80. package/lib/cim/components/helpers/clusterDeployment.ts +9 -4
  81. package/lib/cim/hooks/index.tsx +1 -0
  82. package/lib/cim/hooks/useAgents.tsx +15 -0
  83. package/lib/cim/types/k8s/agent-cluster-install.ts +1 -1
  84. package/lib/common/components/clusterWizard/customManifests/CustomManifestsAlert.tsx +39 -0
  85. package/lib/common/components/clusterWizard/customManifests/index.tsx +1 -0
  86. package/lib/common/components/clusterWizard/index.ts +2 -0
  87. package/lib/common/components/clusterWizard/networkingSteps/ThirdPartyCNIBanner.tsx +28 -0
  88. package/lib/common/components/clusterWizard/networkingSteps/index.ts +1 -0
  89. package/lib/common/types/networkType.ts +9 -8
  90. package/lib/ocm/components/clusterConfiguration/manifestsConfiguration/CustomManifestsPage.tsx +10 -45
  91. package/lib/ocm/components/clusterConfiguration/networkConfiguration/NetworkTypeDropdown.tsx +7 -24
  92. package/lib/ocm/components/clusterConfiguration/review/ReviewNetworkingTable.tsx +9 -3
  93. package/lib/ocm/components/clusterDetail/ClusterProperties.tsx +7 -3
  94. package/package.json +3 -3
  95. package/build/@types/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.d.ts +0 -7
  96. package/build/@types/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.d.ts.map +0 -1
  97. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js +0 -33
  98. package/build/cjs/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.js.map +0 -1
  99. package/lib/common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup.tsx +0 -74
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
3
3
  import { Grid, GridItem, Wizard, WizardStep } from '@patternfly/react-core';
4
- import { AlertsContextProvider, LoadingState } from '../../../common';
4
+ import { AlertsContextProvider, ErrorState, LoadingState } from '../../../common';
5
5
  import { ClusterDeploymentWizardProps } from './types';
6
6
  import { ACMFeatureSupportLevelProvider } from '../featureSupportLevels';
7
7
  import { YamlPreview, useYamlPreview } from '../YamlPreview';
@@ -14,6 +14,7 @@ import { ClusterDeploymentHostsDiscoveryStep } from './hostDiscovery';
14
14
  import { ClusterDeploymentNetworkingStep } from './networking';
15
15
  import { ClusterDeploymentReviewStep } from './review';
16
16
  import { ClusterDeploymentCustomManifestsStep } from './customManifests';
17
+ import { useAgents } from '../../hooks';
17
18
 
18
19
  export const ClusterDeploymentWizard = ({
19
20
  className,
@@ -27,7 +28,6 @@ export const ClusterDeploymentWizard = ({
27
28
  fetchSecret,
28
29
  clusterDeployment,
29
30
  agentClusterInstall,
30
- agents,
31
31
  bareMetalHosts,
32
32
  clusterImages,
33
33
  aiConfigMap,
@@ -54,12 +54,20 @@ export const ClusterDeploymentWizard = ({
54
54
  fetchKlusterletAddonConfig,
55
55
  });
56
56
 
57
+ const [agents, loaded, error] = useAgents({ isList: true });
58
+
57
59
  // if initialStep is set, it is either 'host-selection' or 'host-discovery', both at index 4
58
60
  // if initialStep is not set, start at 'cluster-details' which is at index 2
59
61
  const startIndex = initialStep ? 4 : 2;
60
62
  const stepNames = wizardStepNames(t);
61
63
  const isAIFlow = !!infraEnv;
62
64
 
65
+ if (!loaded) {
66
+ return <LoadingState />;
67
+ } else if (error) {
68
+ return <ErrorState />;
69
+ }
70
+
63
71
  return (
64
72
  <Grid style={{ height: '100%' }}>
65
73
  <GridItem span={isPreviewOpen ? 7 : 12}>
@@ -21,7 +21,7 @@ import {
21
21
  NETWORK_TYPE_OVN,
22
22
  } from '../../../common';
23
23
  import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
24
- import { NetworkTypeControlGroup } from '../../../common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup';
24
+ import { NetworkTypeDropDown } from './networking/NetworkTypeDropdown';
25
25
  import { ClusterDefaultConfig } from '@openshift-assisted/types/assisted-installer-service';
26
26
 
27
27
  export type NetworkConfigurationProps = VirtualIPControlGroupProps & {
@@ -163,6 +163,7 @@ const NetworkConfiguration = ({
163
163
  validateField,
164
164
  primaryMachineNetwork,
165
165
  ]);
166
+
166
167
  return (
167
168
  <Grid hasGutter>
168
169
  {!hideManagedNetworking && <ManagedNetworkingControlGroup />}
@@ -174,6 +175,8 @@ const NetworkConfiguration = ({
174
175
  />
175
176
  )}
176
177
 
178
+ <NetworkTypeDropDown isSDNSelectable={isSDNSelectable} />
179
+
177
180
  {(!isMultiNodeCluster || !isUserManagedNetworking) && (
178
181
  <StackTypeControlGroup
179
182
  clusterId={cluster.id}
@@ -184,8 +187,6 @@ const NetworkConfiguration = ({
184
187
  />
185
188
  )}
186
189
 
187
- <NetworkTypeControlGroup isSDNSelectable={isSDNSelectable} />
188
-
189
190
  {!(isMultiNodeCluster && isUserManagedNetworking) && (
190
191
  <AvailableSubnetsControl
191
192
  clusterId={cluster.id}
@@ -11,7 +11,12 @@ import {
11
11
  GridItem,
12
12
  } from '@patternfly/react-core';
13
13
  import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
14
- import { ClusterWizardStepHeader, useTranslation } from '../../../../common';
14
+ import {
15
+ ClusterWizardStepHeader,
16
+ CustomManifestsAlert,
17
+ isThirdPartyCNI,
18
+ useTranslation,
19
+ } from '../../../../common';
15
20
  import { AgentClusterInstallK8sResource, AgentClusterInstallModel } from '../../../types';
16
21
  import { ConfigMapForm, CustomManifestFormType } from './ConfigMapForm';
17
22
  import { appendPatch } from '../../../utils';
@@ -31,6 +36,9 @@ export const ClusterDeploymentCustomManifestsStep = ({
31
36
  })) || [],
32
37
  };
33
38
 
39
+ const usesExternalPlatform = agentClusterInstall.spec?.platformType === 'External';
40
+ const usesThirdPartyCNI = isThirdPartyCNI(agentClusterInstall.spec?.networking.networkType);
41
+
34
42
  const validationSchema = Yup.lazy((values: CustomManifestFormType) =>
35
43
  Yup.object<CustomManifestFormType>({
36
44
  configMaps: Yup.array()
@@ -54,7 +62,7 @@ export const ClusterDeploymentCustomManifestsStep = ({
54
62
  }),
55
63
  )
56
64
  .min(
57
- agentClusterInstall.spec?.platformType === 'External' ? 1 : 0,
65
+ usesExternalPlatform || usesThirdPartyCNI ? 1 : 0,
58
66
  t('ai:At least one config map is required'),
59
67
  ),
60
68
  }),
@@ -114,6 +122,14 @@ export const ClusterDeploymentCustomManifestsStep = ({
114
122
  </Content>
115
123
  </Alert>
116
124
  </GridItem>
125
+ {(usesExternalPlatform || usesThirdPartyCNI) && (
126
+ <GridItem>
127
+ <CustomManifestsAlert
128
+ usesExternalPlatform={usesExternalPlatform}
129
+ usesThirdPartyCNI={usesThirdPartyCNI}
130
+ />
131
+ </GridItem>
132
+ )}
117
133
  <GridItem>
118
134
  <Formik
119
135
  initialValues={initialValues}
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { useField, useFormikContext } from 'formik';
3
+ import {
4
+ Dropdown,
5
+ DropdownItem,
6
+ FormGroup,
7
+ MenuToggle,
8
+ MenuToggleElement,
9
+ Stack,
10
+ StackItem,
11
+ } from '@patternfly/react-core';
12
+ import { getFieldId } from '../../../../common/components/ui';
13
+ import type { NetworkConfigurationValues } from '../../../../common/types/clusters';
14
+ import {
15
+ NETWORK_TYPE_LABELS,
16
+ NETWORK_TYPE_SDN,
17
+ isThirdPartyCNI,
18
+ } from '../../../../common/types/networkType';
19
+ import { useTranslation } from '../../../../common/hooks';
20
+ import { ThirdPartyCNIBanner } from '../../../../common';
21
+
22
+ export const NetworkTypeDropDown = ({ isSDNSelectable }: { isSDNSelectable: boolean }) => {
23
+ const { t } = useTranslation();
24
+ const [field, , { setValue }] = useField<string>('networkType');
25
+ const [isOpen, setOpen] = React.useState(false);
26
+ const { values } = useFormikContext<NetworkConfigurationValues>();
27
+ const fieldId = getFieldId('networkType', 'input');
28
+
29
+ const showThirdPartyBanner = isThirdPartyCNI(values.networkType);
30
+
31
+ const currentDisplayValue = NETWORK_TYPE_LABELS(t)[field.value];
32
+ const dropdownItems = Object.entries(NETWORK_TYPE_LABELS(t)).map(([value, label]) => (
33
+ <DropdownItem
34
+ key={value}
35
+ id={value}
36
+ value={value}
37
+ isAriaDisabled={value === NETWORK_TYPE_SDN && !isSDNSelectable}
38
+ >
39
+ {label}
40
+ </DropdownItem>
41
+ ));
42
+
43
+ const onSelect = (_event?: React.MouseEvent<Element, MouseEvent>, nextValue?: string): void => {
44
+ if (nextValue) {
45
+ setValue(nextValue);
46
+ }
47
+ setOpen(false);
48
+ };
49
+
50
+ const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
51
+ <MenuToggle
52
+ ref={toggleRef}
53
+ onClick={() => setOpen(!isOpen)}
54
+ isExpanded={isOpen}
55
+ id={fieldId}
56
+ className="pf-v6-u-w-100"
57
+ style={{ minWidth: '100%' }}
58
+ >
59
+ {currentDisplayValue || t('ai:Network type')}
60
+ </MenuToggle>
61
+ );
62
+
63
+ return (
64
+ <Stack hasGutter>
65
+ <StackItem>
66
+ <FormGroup fieldId={fieldId} label={t('ai:Network type')} id={`form-control__${fieldId}`}>
67
+ <Dropdown
68
+ id={`${fieldId}-dropdown`}
69
+ onOpenChange={(open: boolean) => setOpen(open)}
70
+ onSelect={onSelect}
71
+ toggle={toggle}
72
+ isOpen={isOpen}
73
+ >
74
+ {dropdownItems}
75
+ </Dropdown>
76
+ </FormGroup>
77
+ </StackItem>
78
+ {showThirdPartyBanner && <ThirdPartyCNIBanner />}
79
+ </Stack>
80
+ );
81
+ };
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import {
2
3
  Alert,
3
4
  AlertVariant,
@@ -7,7 +8,7 @@ import {
7
8
  useWizardFooter,
8
9
  WizardFooter,
9
10
  } from '@patternfly/react-core';
10
- import * as React from 'react';
11
+ import { PlatformType } from '@openshift-assisted/types/assisted-installer-service';
11
12
  import { canNextFromReviewStep } from '../wizardTransition';
12
13
  import {
13
14
  AgentClusterInstallK8sResource,
@@ -42,7 +43,6 @@ import { useTranslation } from '../../../../common/hooks/use-translation-wrapper
42
43
  import { ClusterDeploymentWizardContext } from '../ClusterDeploymentWizardContext';
43
44
  import { ReviewConfigMapsTable } from './ReviewConfigMapsTable';
44
45
  import { ValidationSection } from '../components/ValidationSection';
45
- import { PlatformType } from '@openshift-assisted/types/assisted-installer-service';
46
46
 
47
47
  type ClusterDeploymentReviewStepProps = {
48
48
  clusterDeployment: ClusterDeploymentK8sResource;
@@ -77,7 +77,8 @@ export const ClusterDeploymentReviewStep = ({
77
77
 
78
78
  const canContinue = canNextFromReviewStep(agentClusterInstall, clusterAgents);
79
79
  const { t } = useTranslation();
80
- const onNext = async () => {
80
+
81
+ const onNext = React.useCallback(async () => {
81
82
  clearAlerts();
82
83
  setSubmitting(true);
83
84
  try {
@@ -88,18 +89,21 @@ export const ClusterDeploymentReviewStep = ({
88
89
  } finally {
89
90
  setSubmitting(false);
90
91
  }
91
- };
92
+ }, [addAlert, clearAlerts, onFinish, t]);
92
93
 
93
- const footer = (
94
- <WizardFooter
95
- activeStep={activeStep}
96
- onNext={onNext}
97
- isNextDisabled={isSubmitting || !canContinue || !!syncError}
98
- nextButtonText={t('ai:Install cluster')}
99
- nextButtonProps={{ isLoading: isSubmitting }}
100
- onBack={goToPrevStep}
101
- onClose={close}
102
- />
94
+ const footer = React.useMemo(
95
+ () => (
96
+ <WizardFooter
97
+ activeStep={activeStep}
98
+ onNext={onNext}
99
+ isNextDisabled={isSubmitting || !canContinue || !!syncError}
100
+ nextButtonText={t('ai:Install cluster')}
101
+ nextButtonProps={{ isLoading: isSubmitting }}
102
+ onBack={goToPrevStep}
103
+ onClose={close}
104
+ />
105
+ ),
106
+ [activeStep, canContinue, close, goToPrevStep, isSubmitting, onNext, syncError, t],
103
107
  );
104
108
  useWizardFooter(footer);
105
109
 
@@ -141,7 +141,6 @@ export type ClusterDeploymentWizardProps = {
141
141
 
142
142
  clusterDeployment: ClusterDeploymentK8sResource;
143
143
  agentClusterInstall: AgentClusterInstallK8sResource;
144
- agents: AgentK8sResource[];
145
144
  bareMetalHosts: BareMetalHostK8sResource[];
146
145
  aiConfigMap?: ConfigMapK8sResource;
147
146
  infraEnv?: InfraEnvK8sResource;
@@ -69,7 +69,11 @@ const networkingStepValidationsMap: WizardStepValidationMap = {
69
69
  // Alternatively we would have to whitelist network validations instead of using group
70
70
  // TODO(mlibra): remove that container-images-available from soft validations and let backend drive it via disabling it.
71
71
  // Depends on: https://issues.redhat.com/browse/MGMT-5265
72
- softValidationIds: ['ntp-synced', 'container-images-available'],
72
+ softValidationIds: [
73
+ 'ntp-synced',
74
+ 'container-images-available',
75
+ 'custom-manifests-requirements-satisfied',
76
+ ],
73
77
  getPageURL: (host: Host, validationID: string) => {
74
78
  if (validationID === 'ntp-synced') {
75
79
  return {
@@ -172,6 +172,11 @@ export const getClusterProperties = (
172
172
  const serviceNetworks = agentClusterInstall.spec?.networking?.serviceNetwork;
173
173
  const clusterNetworks = agentClusterInstall.spec?.networking?.clusterNetwork;
174
174
 
175
+ const apiIPs = agentClusterInstall.spec?.apiVIPs || [agentClusterInstall.spec?.apiVIP];
176
+ const ingressIPs = agentClusterInstall.spec?.ingressVIPs || [
177
+ agentClusterInstall.spec?.ingressVIP,
178
+ ];
179
+
175
180
  return {
176
181
  // TODO: we should translate following keys since they are used "as it is" in AcmDescriptionList.tsx / List component of the stolostron project
177
182
  name: {
@@ -191,12 +196,12 @@ export const getClusterProperties = (
191
196
  value: clusterDeployment.spec?.baseDomain,
192
197
  },
193
198
  apiVip: {
194
- key: 'API IP',
195
- value: agentClusterInstall?.spec?.apiVIP,
199
+ key: apiIPs.length > 1 ? 'API IPs' : 'API IP',
200
+ value: apiIPs.join(', '),
196
201
  },
197
202
  ingressVip: {
198
- key: 'Ingress IP',
199
- value: agentClusterInstall?.spec?.ingressVIP,
203
+ key: ingressIPs.length > 1 ? 'Ingress IPs' : 'Ingress IP',
204
+ value: ingressIPs.join(', '),
200
205
  },
201
206
  clusterNetworkCidr: {
202
207
  key: (clusterNetworks?.length || 0) > 1 ? 'Cluster network CIDRs' : 'Cluster network CIDR',
@@ -1,3 +1,4 @@
1
1
  export * from './useConfigMaps';
2
2
  export * from './useAgentServiceConfig';
3
3
  export * from './useEvents';
4
+ export * from './useAgents';
@@ -0,0 +1,15 @@
1
+ import { useK8sWatchResource } from './useK8sWatchResource';
2
+ import { AgentK8sResource } from '../types';
3
+ import { K8sWatchHookProps } from './types';
4
+
5
+ export const useAgents = (props: K8sWatchHookProps) =>
6
+ useK8sWatchResource<AgentK8sResource[]>(
7
+ {
8
+ groupVersionKind: {
9
+ group: 'agent-install.openshift.io',
10
+ kind: 'Agent',
11
+ version: 'v1beta1',
12
+ },
13
+ },
14
+ props,
15
+ );
@@ -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';
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { useTranslation } from '../../../hooks';
3
+ import { Alert, AlertVariant, Stack, StackItem } from '@patternfly/react-core';
4
+ import { RED_HAT_CNI_SUPPORT_MATRIX_LINK } from '../../../config';
5
+ import { ExternalLink } from '../../ui';
6
+
7
+ export const ThirdPartyCNIBanner = () => {
8
+ const { t } = useTranslation();
9
+
10
+ return (
11
+ <StackItem>
12
+ <Alert variant={AlertVariant.warning} isInline title={t('ai:Third-party CNI')}>
13
+ <Stack hasGutter>
14
+ <StackItem>
15
+ {t(
16
+ 'ai:Third-party CNIs require uploading CNI manifests. Please verify you have the required manifests and that the chosen CNI is compatible with your platform and OpenShift version.',
17
+ )}
18
+ </StackItem>
19
+ <StackItem>
20
+ <ExternalLink href={RED_HAT_CNI_SUPPORT_MATRIX_LINK}>
21
+ {t('ai:Red Hat CNI Support Matrix')}
22
+ </ExternalLink>
23
+ </StackItem>
24
+ </Stack>
25
+ </Alert>
26
+ </StackItem>
27
+ );
28
+ };
@@ -14,3 +14,4 @@ export { VirtualIPControlGroup } from './VirtualIPControlGroup';
14
14
  export type { VirtualIPControlGroupProps } from './VirtualIPControlGroup';
15
15
  export { default as AdvancedNetworkFields } from './AdvancedNetworkFields';
16
16
  export type { AdvancedNetworkFieldsProps } from './AdvancedNetworkFields';
17
+ export * from './ThirdPartyCNIBanner';
@@ -1,4 +1,5 @@
1
1
  import type { FeatureSupportLevelId } from '@openshift-assisted/types/assisted-installer-service';
2
+ import { TFunction } from 'i18next';
2
3
 
3
4
  export type NetworkTypeKey =
4
5
  | 'OVNKubernetes'
@@ -15,14 +16,14 @@ export const NETWORK_TYPE_CILIUM: NetworkTypeKey = 'Cilium';
15
16
  export const NETWORK_TYPE_CALICO: NetworkTypeKey = 'Calico';
16
17
  export const NETWORK_TYPE_NONE: NetworkTypeKey = 'None';
17
18
 
18
- export const NETWORK_TYPE_LABELS: Record<string, string> = {
19
- [NETWORK_TYPE_OVN]: 'Open Virtual Networking (OVN)',
20
- [NETWORK_TYPE_SDN]: 'Software-Defined Networking (SDN)',
21
- [NETWORK_TYPE_CISCO_ACI]: 'Cisco ACI',
22
- [NETWORK_TYPE_CILIUM]: 'Isovalent Cilium',
23
- [NETWORK_TYPE_CALICO]: 'Tigera Calico',
24
- [NETWORK_TYPE_NONE]: 'None (Custom CNI)',
25
- };
19
+ export const NETWORK_TYPE_LABELS = (t: TFunction): Record<string, string> => ({
20
+ [NETWORK_TYPE_OVN]: t('ai:Open Virtual Networking (OVN)'),
21
+ [NETWORK_TYPE_SDN]: t('ai:Software-Defined Networking (SDN)'),
22
+ [NETWORK_TYPE_CISCO_ACI]: t('ai:Cisco ACI'),
23
+ [NETWORK_TYPE_CILIUM]: t('ai:Isovalent Cilium'),
24
+ [NETWORK_TYPE_CALICO]: t('ai:Tigera Calico'),
25
+ [NETWORK_TYPE_NONE]: t('ai:None (Custom CNI)'),
26
+ });
26
27
 
27
28
  export const NETWORK_TYPE_FEATURE_IDS: Record<string, FeatureSupportLevelId> = {
28
29
  [NETWORK_TYPE_OVN]: 'OVN_NETWORK_TYPE',
@@ -3,19 +3,21 @@ import {
3
3
  Content,
4
4
  ContentVariants,
5
5
  Alert,
6
- AlertVariant,
7
6
  Grid,
8
7
  FormGroup,
9
8
  Switch,
10
9
  Tooltip,
11
- Stack,
12
- StackItem,
13
10
  } from '@patternfly/react-core';
14
11
 
15
12
  import { CustomManifests } from './components/CustomManifests';
16
13
  import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
17
14
  import { CustomManifestFormState } from './components/propTypes';
18
- import { ClustersAPI, ClusterWizardStepHeader, isThirdPartyCNI } from '../../../../common';
15
+ import {
16
+ ClustersAPI,
17
+ ClusterWizardStepHeader,
18
+ CustomManifestsAlert,
19
+ isThirdPartyCNI,
20
+ } from '../../../../common';
19
21
  import { getFieldId } from '../../../../common/components/ui/formik';
20
22
  import { isOciPlatformType } from '../../utils';
21
23
  import DeleteCustomManifestModal from './DeleteCustomManifestModal';
@@ -90,46 +92,6 @@ export const CustomManifestsPage = ({
90
92
  ? 'Custom manifests are required when using a third-party CNI or Oracle Cloud Infrastructure.'
91
93
  : '';
92
94
 
93
- const showExternalPlatformReminder = isOciPlatformType(cluster);
94
- const showThirdPartyCnIReminder = isThirdPartyCNI(cluster.networkType);
95
- const showCombinedReminder = showExternalPlatformReminder && showThirdPartyCnIReminder;
96
- let reminderAlerts: React.ReactNode = null;
97
- if (showCombinedReminder) {
98
- reminderAlerts = (
99
- <Stack>
100
- <StackItem>
101
- <Alert
102
- variant={AlertVariant.info}
103
- isInline
104
- title="You're using an external platform and a third-party CNI"
105
- >
106
- Make sure to upload the required custom and CNI manifests in this step.
107
- </Alert>
108
- </StackItem>
109
- </Stack>
110
- );
111
- } else if (showExternalPlatformReminder) {
112
- reminderAlerts = (
113
- <Stack>
114
- <StackItem>
115
- <Alert variant={AlertVariant.info} isInline title="You're using an external platform">
116
- Make sure to upload the required custom manifests in this step.
117
- </Alert>
118
- </StackItem>
119
- </Stack>
120
- );
121
- } else if (showThirdPartyCnIReminder) {
122
- reminderAlerts = (
123
- <Stack>
124
- <StackItem>
125
- <Alert variant={AlertVariant.info} isInline title="You're using a third-party CNI">
126
- Make sure to upload the required CNI manifests in this step.
127
- </Alert>
128
- </StackItem>
129
- </Stack>
130
- );
131
- }
132
-
133
95
  return (
134
96
  <Grid hasGutter>
135
97
  <Content>
@@ -157,7 +119,10 @@ export const CustomManifestsPage = ({
157
119
  {!useCustomManifests && <div style={{ minHeight: '250px' }} aria-hidden="true" />}
158
120
  {useCustomManifests && (
159
121
  <>
160
- {reminderAlerts}
122
+ <CustomManifestsAlert
123
+ usesExternalPlatform={isOciPlatformType(cluster)}
124
+ usesThirdPartyCNI={isThirdPartyCNI(cluster.networkType)}
125
+ />
161
126
  <Alert
162
127
  isInline
163
128
  variant="warning"
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useField, useFormikContext } from 'formik';
3
3
  import {
4
- Alert,
5
- AlertVariant,
6
4
  Dropdown,
7
5
  DropdownItem,
8
6
  FormGroup,
@@ -12,7 +10,7 @@ import {
12
10
  StackItem,
13
11
  Tooltip,
14
12
  } from '@patternfly/react-core';
15
- import { getFieldId, ExternalLink } from '../../../../common/components/ui';
13
+ import { getFieldId } from '../../../../common/components/ui';
16
14
  import {
17
15
  NewFeatureSupportLevelMap,
18
16
  useNewFeatureSupportLevel,
@@ -25,7 +23,8 @@ import {
25
23
  NETWORK_TYPE_FEATURE_IDS,
26
24
  isThirdPartyCNI,
27
25
  } from '../../../../common/types/networkType';
28
- import { RED_HAT_CNI_SUPPORT_MATRIX_LINK } from '../../../../common/config/docs_links';
26
+ import { useTranslation } from '../../../../common/hooks';
27
+ import { ThirdPartyCNIBanner } from '../../../../common';
29
28
 
30
29
  export interface NetworkTypeDropDownProps {
31
30
  isDisabled?: boolean;
@@ -36,6 +35,7 @@ export const NetworkTypeDropDown = ({
36
35
  isDisabled = false,
37
36
  featureSupportLevelData,
38
37
  }: NetworkTypeDropDownProps) => {
38
+ const { t } = useTranslation();
39
39
  const [field, , { setValue }] = useField<string>('networkType');
40
40
  const [isOpen, setOpen] = React.useState(false);
41
41
  const { values } = useFormikContext<NetworkConfigurationValues>();
@@ -54,9 +54,9 @@ export const NetworkTypeDropDown = ({
54
54
  }
55
55
  }, [field.value, setValue, featureSupportLevelData, getFeatureDisabledReason]);
56
56
 
57
- const currentDisplayValue = NETWORK_TYPE_LABELS[field.value];
57
+ const currentDisplayValue = NETWORK_TYPE_LABELS(t)[field.value];
58
58
 
59
- const dropdownItems = Object.entries(NETWORK_TYPE_LABELS).map(([value, label]) => {
59
+ const dropdownItems = Object.entries(NETWORK_TYPE_LABELS(t)).map(([value, label]) => {
60
60
  const disabledReason = getFeatureDisabledReason(
61
61
  NETWORK_TYPE_FEATURE_IDS[value],
62
62
  featureSupportLevelData ?? undefined,
@@ -119,24 +119,7 @@ export const NetworkTypeDropDown = ({
119
119
  </Dropdown>
120
120
  </FormGroup>
121
121
  </StackItem>
122
- {showThirdPartyBanner && (
123
- <StackItem>
124
- <Alert variant={AlertVariant.warning} isInline title="Third-party CNI">
125
- <Stack hasGutter>
126
- <StackItem>
127
- Third-party CNIs require uploading CNI manifests. Please verify you have the
128
- required manifests and that the chosen CNI is compatible with your platform and
129
- OpenShift version.
130
- </StackItem>
131
- <StackItem>
132
- <ExternalLink href={RED_HAT_CNI_SUPPORT_MATRIX_LINK}>
133
- Red Hat CNI Support Matrix
134
- </ExternalLink>
135
- </StackItem>
136
- </Stack>
137
- </Alert>
138
- </StackItem>
139
- )}
122
+ {showThirdPartyBanner && <ThirdPartyCNIBanner />}
140
123
  </Stack>
141
124
  );
142
125
  };
@@ -1,7 +1,12 @@
1
1
  import { Title } from '@patternfly/react-core';
2
2
  import { Table, TableVariant, Tbody, Td, Tr } from '@patternfly/react-table';
3
3
  import React from 'react';
4
- import { genericTableRowKey, isDualStack, NETWORK_TYPE_LABELS } from '../../../../common';
4
+ import {
5
+ genericTableRowKey,
6
+ isDualStack,
7
+ NETWORK_TYPE_LABELS,
8
+ useTranslation,
9
+ } from '../../../../common';
5
10
  import { getManagementType, getStackTypeLabel } from '../../clusterDetail/ClusterProperties';
6
11
  import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
7
12
 
@@ -11,6 +16,7 @@ type ReviewTableRowsType = {
11
16
  }[];
12
17
 
13
18
  export const ReviewNetworkingTable = ({ cluster }: { cluster: Cluster }) => {
19
+ const { t } = useTranslation();
14
20
  const rows = React.useMemo(() => {
15
21
  const networkRows = [
16
22
  {
@@ -197,13 +203,13 @@ export const ReviewNetworkingTable = ({ cluster }: { cluster: Cluster }) => {
197
203
  cells: [
198
204
  { title: 'Networking type' },
199
205
  {
200
- title: cluster.networkType ? NETWORK_TYPE_LABELS[cluster.networkType] : '-',
206
+ title: cluster.networkType ? NETWORK_TYPE_LABELS(t)[cluster.networkType] : '-',
201
207
  props: { 'data-testid': 'networking-type', colSpan: 2 },
202
208
  },
203
209
  ],
204
210
  },
205
211
  ] as ReviewTableRowsType;
206
- }, [cluster]);
212
+ }, [cluster, t]);
207
213
 
208
214
  return (
209
215
  <>