Skip to content

Commit

Permalink
MGMT-18987: Allow ISO type configuration from kube API [2.14-cim] (#2765
Browse files Browse the repository at this point in the history
)

* adding iso type minimal+full

* keeping buttons group section hide when ipxe

---------

Co-authored-by: Liat Berkovich <[email protected]>
  • Loading branch information
jgyselov and liatb-rh authored Jan 14, 2025
1 parent 624cd67 commit 9eb9a56
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
"ai:For example: host-{{n}}": "For example: host-{{n}}",
"ai:Format?": "Format?",
"ai:Forwarding it could put your credentials and personal data at risk.": "Forwarding it might put your credentials and personal data at risk.",
"ai:Full image file: Provision with physical media": "Full image file: Provision with physical media",
"ai:Full image file": "Full image file",
"ai:General configuration": "General configuration",
"ai:Generate Discovery ISO": "Generate Discovery ISO",
"ai:Generate script file": "Generate script file",
Expand Down Expand Up @@ -512,7 +512,7 @@
"ai:Message": "Message",
"ai:Metal3 operator is not configured": "Metal3 operator is not configured",
"ai:Migration toolkit for virtualization requirements": "Migration toolkit for virtualization requirements",
"ai:Minimal image file: Provision with virtual media": "Minimal image file: Provision with virtual media",
"ai:Minimal image file": "Minimal image file",
"ai:Minimal value is 10Gi": "Minimal value is 10Gi",
"ai:Minimal value is 1Gi": "Minimal value is 1Gi",
"ai:Minimum CPU cores": "Minimum CPU cores",
Expand Down
9 changes: 4 additions & 5 deletions libs/ui-lib/lib/cim/components/modals/AddHostModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ const AddHostModal: React.FC<AddHostModalProps> = ({
const hasDHCP = infraEnv.metadata?.labels?.networkType !== 'static';
const sshPublicKey = infraEnv.spec?.sshAuthorizedKey || agentClusterInstall?.spec?.sshPublicKey;
const { httpProxy, httpsProxy, noProxy } = infraEnv.spec?.proxy || {};

const isoDialog = agentClusterInstall ? 'config' : 'download';
const [dialogType, setDialogType] = React.useState<AddHostModalStepType>(isoDialog);
const imageType = infraEnv.spec?.imageType || 'minimal-iso';
const [dialogType, setDialogType] = React.useState<AddHostModalStepType>('config');
const { t } = useTranslation();
const handleIsoConfigSubmit = async (
values: DiscoveryImageFormValues,
Expand Down Expand Up @@ -66,8 +65,8 @@ const AddHostModal: React.FC<AddHostModalProps> = ({
<DiscoveryImageConfigForm
onCancel={onClose}
handleSubmit={handleIsoConfigSubmit}
hideDiscoveryImageType={true} // So far configured by env variable on backend
imageType="full-iso" // So far the only option for CIM
hideDiscoveryImageType={isIPXE}
imageType={imageType}
sshPublicKey={sshPublicKey}
httpProxy={httpProxy}
httpsProxy={httpsProxy}
Expand Down
1 change: 1 addition & 0 deletions libs/ui-lib/lib/cim/types/k8s/infra-env-k8s-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type InfraEnvK8sResource = K8sResourceCommon & {
additionalNTPSources?: string[];
cpuArchitecture?: 'x86_64' | 'arm64' | 's390x';
osImageVersion?: string;
imageType?: 'full-iso' | 'minimal-iso';
};
status?: {
agentLabelSelector?: Selector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,24 @@ export const DiscoveryImageConfigForm: React.FC<DiscoveryImageConfigFormProps> =
<>
<ModalBoxBody>
<Stack hasGutter>
<StackItem>
<Alert
variant={AlertVariant.info}
isInline
title={
isIPXE
? t('ai:To add hosts to the cluster, generate iPXE script.')
: t('ai:To add hosts to the cluster, generate a Discovery ISO.')
}
/>
</StackItem>
{hasDHCP === false && (
<StackItem>
<StaticIPInfo docVersion={docVersion} />
</StackItem>
)}
<StackItem>
<Form>
<AlertFormikError status={status as StatusErrorType} />
{!hideDiscoveryImageType && <DiscoveryImageTypeControlGroup />}
<AlertFormikError status={status as StatusErrorType} />
<Alert
variant={AlertVariant.info}
isInline
title={
isIPXE
? t('ai:To add hosts to the cluster, generate iPXE script.')
: t('ai:To add hosts to the cluster, generate a Discovery ISO.')
}
/>
<UploadSSH />
<ProxyFields />
</Form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Stack, StackItem } from '@patternfly/react-core';
import { Flex, FlexItem } from '@patternfly/react-core';
import { PopoverIcon, RadioField } from '../ui';
import { useTranslation } from '../../hooks/use-translation-wrapper';

Expand All @@ -20,38 +20,38 @@ const DiscoveryImageTypeControlGroupLabel = ({
const DiscoveryImageTypeControlGroup = () => {
const { t } = useTranslation();
return (
<Stack hasGutter>
<StackItem>
<Flex>
<FlexItem spacer={{ default: 'spacer3xl' }}>
<RadioField
name={GROUP_NAME}
id={'minimal-iso'}
value={'minimal-iso'}
label={
<DiscoveryImageTypeControlGroupLabel
text={t('ai:Minimal image file: Provision with virtual media')}
text={t('ai:Minimal image file')}
popoverContent={t(
"ai:Recommended option. The generated discovery ISO will be smaller, but will need to download additional data during boot. This option is useful if ISO storage capacity is limited or if it's being served over a constrained network.",
)}
/>
}
/>
</StackItem>
<StackItem>
</FlexItem>
<FlexItem>
<RadioField
name={GROUP_NAME}
id={'full-iso'}
value={'full-iso'}
label={
<DiscoveryImageTypeControlGroupLabel
text={t('ai:Full image file: Provision with physical media')}
text={t('ai:Full image file')}
popoverContent={t(
'ai:The generated discovery ISO will contain everything needed to boot.',
)}
/>
}
/>
</StackItem>
</Stack>
</FlexItem>
</Flex>
);
};

Expand Down

0 comments on commit 9eb9a56

Please sign in to comment.