Skip to content

Commit 6b5d508

Browse files
authoredNov 22, 2024
Bump AI Lib to 2.13.0-cim (stolostron#4093)
* Update Assisted Installer UI Lib to 2.13.0-cim Signed-off-by: jgyselov <jgyselov@redhat.com> * Allow selecting OpenShift version when creating infraEnv Signed-off-by: jgyselov <jgyselov@redhat.com> * Filter OpenShift versions based on availability in AgentServiceConfig Signed-off-by: jgyselov <jgyselov@redhat.com> * Fix formatting Signed-off-by: jgyselov <jgyselov@redhat.com> --------- Signed-off-by: jgyselov <jgyselov@redhat.com>
1 parent 11b0755 commit 6b5d508

File tree

7 files changed

+51
-36
lines changed

7 files changed

+51
-36
lines changed
 

‎frontend/package-lock.json

+24-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎frontend/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"@mui/material": "^5.11.1",
4444
"@octokit/rest": "19.0.3",
4545
"@octokit/types": "6.40.0",
46-
"@openshift-assisted/locales": "2.12.1-cim",
47-
"@openshift-assisted/ui-lib": "2.12.1-cim",
46+
"@openshift-assisted/locales": "2.13.0-cim",
47+
"@openshift-assisted/ui-lib": "2.13.0-cim",
4848
"@patternfly-labs/react-form-wizard": "^1.32.0",
4949
"@patternfly/patternfly": "4.196.7",
5050
"@patternfly/react-charts": "^6.74.3",

‎frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/DetailsForm.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import React from 'react'
3131
import { FieldName } from './types'
3232
import { getFieldLabels } from './hypershift/utils'
33+
import { getFirstAgentServiceConfig } from '../../../../../InfraEnvironments/InfraEnvironmentsPage'
3334

3435
type FormControl = {
3536
active: ClusterDetailsValues & {
@@ -120,7 +121,7 @@ export const getExtensionAfter = ({
120121
})
121122

122123
const DetailsForm: React.FC<DetailsFormProps> = ({ control, handleChange, controlProps }) => {
123-
const { clusterDeploymentsState, clusterImageSetsState } = useSharedAtoms()
124+
const { clusterDeploymentsState, clusterImageSetsState, agentServiceConfigsState } = useSharedAtoms()
124125
const clusterDeployments = useRecoilValue(clusterDeploymentsState)
125126
const clusterImageSets = useRecoilValue(clusterImageSetsState)
126127
const formRef = useRef<FormikProps<any>>(null)
@@ -215,6 +216,8 @@ const DetailsForm: React.FC<DetailsFormProps> = ({ control, handleChange, contro
215216
}, [control])
216217

217218
const clusterImages = useClusterImages()
219+
const agentServiceConfigs = useRecoilValue(agentServiceConfigsState)
220+
const agentServiceConfig = getFirstAgentServiceConfig(agentServiceConfigs)
218221

219222
const usedClusterNames = useMemo(() => clusterDeployments.map((cd) => cd.metadata.name || ''), [])
220223

@@ -285,6 +288,7 @@ const DetailsForm: React.FC<DetailsFormProps> = ({ control, handleChange, contro
285288
usedClusterNames={usedClusterNames}
286289
extensionAfter={extensionAfter}
287290
isNutanix={control.additionalProps?.isNutanix}
291+
osImages={agentServiceConfig?.spec.osImages}
288292
/>
289293
</ACMFeatureSupportLevelProvider>
290294
</FeatureGateContextProvider>

‎frontend/src/routes/Infrastructure/InfraEnvironments/InfraEnvForm.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import {
1717
Stack,
1818
StackItem,
1919
} from '@patternfly/react-core'
20-
import { InfraEnvFormPage, EnvironmentStepFormValues } from '@openshift-assisted/ui-lib/cim'
20+
import {
21+
InfraEnvFormPage,
22+
EnvironmentStepFormValues,
23+
AgentServiceConfigK8sResource,
24+
} from '@openshift-assisted/ui-lib/cim'
2125
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
2226
import { FormikProps } from 'formik'
2327

@@ -76,8 +80,11 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({ control, handleChange }) =>
7680
const { providerConnectionsValue } = useSharedSelectors()
7781
const allProviderConnections = useRecoilValue(providerConnectionsValue)
7882
const { projects } = useProjects()
79-
const { infraEnvironmentsState } = useSharedAtoms()
83+
const { infraEnvironmentsState, agentServiceConfigsState } = useSharedAtoms()
8084
const infraEnvironments = useRecoilValue(infraEnvironmentsState)
85+
const agentServiceConfigs = useRecoilValue(agentServiceConfigsState)
86+
const osImages = (agentServiceConfigs?.[0] as AgentServiceConfigK8sResource)?.spec.osImages || []
87+
8188
const formRef = useRef<FormikProps<any>>(null)
8289

8390
const providerConnections = allProviderConnections.filter((p) => {
@@ -139,6 +146,7 @@ const InfraEnvForm: React.FC<InfraEnvFormProps> = ({ control, handleChange }) =>
139146
pullSecret={currentConnection?.stringData?.['pullSecret']}
140147
sshPublicKey={currentConnection?.stringData?.['ssh-publickey']}
141148
docVersion={DOC_VERSION}
149+
osImages={osImages}
142150
>
143151
<FormGroup fieldId="credentials" label={t('Infrastructure provider credentials')}>
144152
<Select

‎frontend/src/routes/Infrastructure/InfraEnvironments/InfraEnvironmentsPage.test.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { nockIgnoreApiPaths, nockIgnoreRBAC } from '../../../lib/nock-util'
1515
import { waitForTestId, waitForText } from '../../../lib/test-util'
1616
import { NavigationPath } from '../../../NavigationPath'
1717
import InfraEnvironmentsPage, {
18-
getFirstAgenterviceConfig,
18+
getFirstAgentServiceConfig,
1919
getInfraEnvsOfMatchingPullSecret,
2020
getPlatform,
2121
isDeleteDisabled,
@@ -164,10 +164,10 @@ describe('Infrastructure Environments page utility functions', () => {
164164

165165
expect(isDeleteDisabled([{}], [mockAgent1, mockAgent2])).toBe(true)
166166
})
167-
test('getFirstAgenterviceConfig', () => {
168-
expect(getFirstAgenterviceConfig(undefined)).toBe(undefined)
169-
expect(getFirstAgenterviceConfig([])).toBe(undefined)
170-
expect(getFirstAgenterviceConfig([{} as AgentServiceConfigK8sResource])).not.toBe(undefined)
167+
test('getFirstAgentServiceConfig', () => {
168+
expect(getFirstAgentServiceConfig(undefined)).toBe(undefined)
169+
expect(getFirstAgentServiceConfig([])).toBe(undefined)
170+
expect(getFirstAgentServiceConfig([{} as AgentServiceConfigK8sResource])).not.toBe(undefined)
171171
})
172172
test('getPlatform', () => {
173173
expect(getPlatform(undefined)).toBe('None')

‎frontend/src/routes/Infrastructure/InfraEnvironments/InfraEnvironmentsPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const isDeleteDisabled = (infraEnvs: InfraEnvK8sResource[], agents: Agent
7878
return isDisabled
7979
}
8080

81-
export const getFirstAgenterviceConfig = (agentServiceConfigs?: AgentServiceConfigK8sResource[]) =>
81+
export const getFirstAgentServiceConfig = (agentServiceConfigs?: AgentServiceConfigK8sResource[]) =>
8282
agentServiceConfigs?.[0]
8383

8484
export const getPlatform = (infrastructures?: InfrastructureK8sResource[]) =>
@@ -192,7 +192,7 @@ const InfraEnvironmentsPage: React.FC = () => {
192192
}, [])
193193

194194
const platform: string = infrastructures?.[0]?.status?.platform || 'None'
195-
const agentServiceConfig = getFirstAgenterviceConfig(agentServiceConfigs)
195+
const agentServiceConfig = getFirstAgentServiceConfig(agentServiceConfigs)
196196
const isStorage = isStorageConfigured({ storageClasses: storageClasses as K8sResourceCommon[] | undefined })
197197

198198
return (

‎frontend/src/routes/Infrastructure/InfraEnvironments/infraenv-template.hbs

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ spec:
4848
{{#if ai.cpuArchitecture}}
4949
cpuArchitecture: {{{ai.cpuArchitecture}}}
5050
{{/if}}
51+
{{#if ai.osImageVersion}}
52+
osImageVersion: '{{{ ai.osImageVersion }}}'
53+
{{/if}}
5154
status:
5255
agentLabelSelector:
5356
matchLabels:

0 commit comments

Comments
 (0)