Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Only show rolling upgrade warning if an outdated agent is selected #136764

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* 2.0.
*/

// Available versions for the upgrade of the Elastic Agent
export const ROLLING_UPGRADE_MINIMUM_SUPPORTED_VERSION = '8.3.0';

// Available versions for the upgrade of the Elastic Agent
export const FALLBACK_VERSIONS = [
'8.2.1',
'8.2.0',
Expand All @@ -23,4 +24,4 @@ export const FALLBACK_VERSIONS = [
'7.17.0',
];

export const MAINTAINANCE_VALUES = [0, 1, 2, 4, 8, 12, 24, 48];
export const MAINTENANCE_VALUES = [0, 1, 2, 4, 8, 12, 24, 48];
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('AgentUpgradeAgentModal', () => {
});

const el = utils.container.querySelector(
'[data-test-subj="agentUpgradeModal.MaintainanceCombobox"]'
'[data-test-subj="agentUpgradeModal.MaintenanceCombobox"]'
);
expect(el).not.toBeNull();
expect(el?.textContent).toBe('Immediately');
Expand All @@ -56,10 +56,9 @@ describe('AgentUpgradeAgentModal', () => {
});

const el = utils.container.querySelector(
'[data-test-subj="agentUpgradeModal.MaintainanceCombobox"]'
'[data-test-subj="agentUpgradeModal.MaintenanceCombobox"]'
);
expect(el).not.toBeNull();
expect(el).not.toBeNull();
expect(el?.textContent).toBe('Immediately');
});

Expand All @@ -70,7 +69,7 @@ describe('AgentUpgradeAgentModal', () => {
});

const el = utils.container.querySelector(
'[data-test-subj="agentUpgradeModal.MaintainanceCombobox"]'
'[data-test-subj="agentUpgradeModal.MaintenanceCombobox"]'
);

expect(el).not.toBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { EuiComboBoxOptionOption } from '@elastic/eui';

import semverCoerce from 'semver/functions/coerce';
import semverGt from 'semver/functions/gt';
import semverLt from 'semver/functions/lt';
import semverValid from 'semver/functions/valid';

import { getMinVersion } from '../../../../../../../common/services/get_min_max_version';
Expand All @@ -36,7 +37,11 @@ import {
useKibanaVersion,
} from '../../../../hooks';

import { FALLBACK_VERSIONS, MAINTAINANCE_VALUES } from './constants';
import {
FALLBACK_VERSIONS,
MAINTENANCE_VALUES,
ROLLING_UPGRADE_MINIMUM_SUPPORTED_VERSION,
} from './constants';
import { useScheduleDateTime } from './hooks';

export interface AgentUpgradeAgentModalProps {
Expand All @@ -48,6 +53,14 @@ export interface AgentUpgradeAgentModalProps {

const getVersion = (version: Array<EuiComboBoxOptionOption<string>>) => version[0]?.value as string;

function isVersionUnsupported(version?: string) {
if (!version) {
return false;
}

return semverLt(version, ROLLING_UPGRADE_MINIMUM_SUPPORTED_VERSION);
}

export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentModalProps> = ({
onClose,
agents,
Expand Down Expand Up @@ -93,11 +106,11 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
}, [fallbackVersions, minVersion]);
const noVersions = versionOptions[0]?.value === '';

const maintainanceOptions: Array<EuiComboBoxOptionOption<number>> = MAINTAINANCE_VALUES.map(
const maintenanceOptions: Array<EuiComboBoxOptionOption<number>> = MAINTENANCE_VALUES.map(
(option) => ({
label:
option === 0
? i18n.translate('xpack.fleet.upgradeAgents.noMaintainanceWindowOption', {
? i18n.translate('xpack.fleet.upgradeAgents.noMaintenanceWindowOption', {
defaultMessage: 'Immediately',
})
: i18n.translate('xpack.fleet.upgradeAgents.hourLabel', {
Expand All @@ -108,8 +121,8 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
})
);
const [selectedVersion, setSelectedVersion] = useState([versionOptions[0]]);
const [selectedMantainanceWindow, setSelectedMantainanceWindow] = useState([
isSmallBatch ? maintainanceOptions[0] : maintainanceOptions[1],
const [selectedMaintenanceWindow, setSelectedMaintenanceWindow] = useState([
isSmallBatch ? maintenanceOptions[0] : maintenanceOptions[1],
]);

const { startDatetime, onChangeStartDateTime, initialDatetime, minTime, maxTime } =
Expand All @@ -119,8 +132,8 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
const version = getVersion(selectedVersion);
const rolloutOptions = {
rollout_duration_seconds:
selectedMantainanceWindow.length > 0 && (selectedMantainanceWindow[0]?.value as number) > 0
? selectedMantainanceWindow[0].value
selectedMaintenanceWindow.length > 0 && (selectedMaintenanceWindow[0]?.value as number) > 0
? selectedMaintenanceWindow[0].value
: undefined,
start_time: startDatetime.toISOString(),
};
Expand Down Expand Up @@ -325,14 +338,22 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
customOptionText="Input the desired version"
/>
</EuiFormRow>
{!isSingleAgent ? (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this isSingleAgent distinction, but I'm not sure if that's necessary.

Copy link
Member

@nchaulet nchaulet Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not use the bulk upgrade and do not provide rolling upgrade option for single agent so it probably make no sense to show the warning for single agent.

{!isSingleAgent &&
Array.isArray(agents) &&
agents.some((agent) =>
isVersionUnsupported(agent.local_metadata?.elastic?.agent?.version)
) ? (
<>
<EuiSpacer size="m" />
<EuiCallOut
color="warning"
title={i18n.translate('xpack.fleet.upgradeAgents.warningCallout', {
defaultMessage: 'Rolling upgrade only available for Elastic Agent versions 8.3+',
})}
title={
<FormattedMessage
id="xpack.fleet.upgradeAgents.warningCallout"
defaultMessage="Rolling upgrades are only available for Elastic Agent versions {version} and higher"
values={{ version: <strong>{ROLLING_UPGRADE_MINIMUM_SUPPORTED_VERSION}</strong> }}
/>
}
/>
</>
) : null}
Expand Down Expand Up @@ -365,21 +386,18 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
label={
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={false}>
{i18n.translate('xpack.fleet.upgradeAgents.maintainanceAvailableLabel', {
{i18n.translate('xpack.fleet.upgradeAgents.maintenanceAvailableLabel', {
defaultMessage: 'Maintenance window available',
})}
</EuiFlexItem>
<EuiSpacer size="xs" />
<EuiFlexItem grow={false}>
<EuiToolTip
position="top"
content={i18n.translate(
'xpack.fleet.upgradeAgents.maintainanceAvailableTooltip',
{
defaultMessage:
'Defines the duration of time available to perform the upgrade. The agent upgrades are spread uniformly across this duration in order to avoid exhausting network resources.',
}
)}
content={i18n.translate('xpack.fleet.upgradeAgents.maintenanceAvailableTooltip', {
defaultMessage:
'Defines the duration of time available to perform the upgrade. The agent upgrades are spread uniformly across this duration in order to avoid exhausting network resources.',
})}
>
<EuiIcon type="iInCircle" title="TooltipIcon" />
</EuiToolTip>
Expand All @@ -389,17 +407,17 @@ export const AgentUpgradeAgentModal: React.FunctionComponent<AgentUpgradeAgentMo
fullWidth
>
<EuiComboBox
data-test-subj="agentUpgradeModal.MaintainanceCombobox"
data-test-subj="agentUpgradeModal.MaintenanceCombobox"
fullWidth
isClearable={false}
singleSelection={{ asPlainText: true }}
options={maintainanceOptions}
selectedOptions={selectedMantainanceWindow}
options={maintenanceOptions}
selectedOptions={selectedMaintenanceWindow}
onChange={(selected: Array<EuiComboBoxOptionOption<number>>) => {
if (!selected.length) {
return;
}
setSelectedMantainanceWindow(selected);
setSelectedMaintenanceWindow(selected);
}}
/>
</EuiFormRow>
Expand Down
101 changes: 1 addition & 100 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -13748,116 +13748,17 @@
"xpack.fleet.upgradeAgents.confirmSingleButtonLabel": "Mettre à niveau l'agent",
"xpack.fleet.upgradeAgents.fatalErrorNotificationTitle": "Erreur lors de la mise à niveau de {count, plural, one {l'agent} other {{count} agents} =true {tous les agents sélectionnés}}",
"xpack.fleet.upgradeAgents.hourLabel": "{option} {count, plural, one {heure} other {heures}}",
"xpack.fleet.upgradeAgents.maintainanceAvailableLabel": "Fenêtre de maintenance disponible",
"xpack.fleet.upgradeAgents.maintainanceAvailableTooltip": "Définit la durée disponible pour effectuer la mise à niveau. Les mises à niveau de l'agent sont réparties uniformément pendant cette durée pour éviter d'épuiser les ressources réseau.",
"xpack.fleet.upgradeAgents.noMaintainanceWindowOption": "Immédiatement",
"xpack.fleet.upgradeAgents.scheduleUpgradeMultipleTitle": "Planifier la mise à niveau pour {count, plural, one {l'agent} other {{count} agents} =true {tous les agents sélectionnés}}",
"xpack.fleet.upgradeAgents.scheduleUpgradeMultipleTitle": "Planifier la mise à niveau pour {count, plural, one {l'agent} other {{count} agents} =true {tous les agents sélectionnés}}",
"xpack.fleet.upgradeAgents.startTimeLabel": "Date et heure sélectionnées",
"xpack.fleet.upgradeAgents.successMultiNotificationTitle": "{isMixed, select, true {{success} agents sur {total}} other {{isAllAgents, select, true {Tous les agents sélectionnés} other {{success}} }}} mis à niveau",
"xpack.fleet.upgradeAgents.successSingleNotificationTitle": "{count} agent mis à niveau",
"xpack.fleet.upgradeAgents.upgradeMultipleDescription": "Cette action met à niveau plusieurs agents vers la version {version}. Impossible d'annuler cette action. Voulez-vous vraiment continuer ?",
"xpack.fleet.upgradeAgents.upgradeMultipleTitle": "Mettre à niveau {count, plural, one {l'agent} other {{count} agents} =true {tous les agents sélectionnés}}",
"xpack.fleet.upgradeAgents.upgradeSingleDescription": "Cette action met à niveau l'agent qui s'exécute sur \"{hostName}\" vers la version {version}. Impossible d'annuler cette action. Voulez-vous vraiment continuer ?",
"xpack.fleet.upgradeAgents.upgradeSingleTitle": "Mettre à niveau l'agent",
"xpack.fleet.upgradeAgents.warningCallout": "Mise à niveau propagée uniquement disponible pour Elastic Agent à partir de la version 8.3",
"xpack.fleet.upgradeAgents.warningCalloutErrors": "Erreur lors de la mise à niveau de {count, plural, one {l'agent sélectionné} other {{count} agents sélectionnés}}",
"xpack.fleet.upgradePackagePolicy.pageDescriptionFromUpgrade": "Mettre à niveau cette intégration et déployer les modifications sur la stratégie d'agent sélectionnée",
"xpack.fleet.upgradePackagePolicy.pageTitle": "Mettre à niveau l'intégration",
"xpack.fleet.upgradePackagePolicy.previousVersionFlyout.title": "Stratégie d'intégration \"{name}\"",
"xpack.fleet.upgradePackagePolicy.statusCallout.errorContent": "Cette intégration contient des champs conflictuels entre la version {currentVersion} et la version {upgradeVersion}. Vérifiez la configuration, puis enregistrez pour exécuter la mise à niveau. Vous pouvez consulter votre {previousConfigurationLink} pour comparer.",
"xpack.fleet.upgradePackagePolicy.statusCallOut.errorTitle": "Examiner les conflits entre les champs",
"xpack.fleet.upgradePackagePolicy.statusCallout.previousConfigurationLink": "configuration précédente",
"xpack.fleet.upgradePackagePolicy.statusCallout.successContent": "Cette intégration est prête pour une mise à niveau de la version {currentVersion} vers la version {upgradeVersion}. Vérifiez les modifications ci-après et enregistrez pour effectuer la mise à niveau.",
"xpack.fleet.upgradePackagePolicy.statusCallOut.successTitle": "Prêt pour la mise à niveau",
"xpack.globalSearch.find.invalidLicenseError": "L'API GlobalSearch est désactivée, car l'état de licence n'est pas valide : {errorMessage}",
"xpack.globalSearchBar.searchBar.helpText.helpTextConjunction": "ou",
"xpack.globalSearchBar.searchBar.helpText.helpTextPrefix": "Filtrer par",
"xpack.globalSearchBar.searchBar.mobileSearchButtonAriaLabel": "Recherche sur l'ensemble du site",
"xpack.globalSearchBar.searchBar.noResults": "Essayez de rechercher des applications, des tableaux de bord, des visualisations, etc.",
"xpack.globalSearchBar.searchBar.noResultsHeading": "Résultat introuvable",
"xpack.globalSearchBar.searchBar.noResultsImageAlt": "Illustration d'un trou noir",
"xpack.globalSearchBar.searchBar.optionTagListAriaLabel": "Balises",
"xpack.globalSearchBar.searchbar.overflowTagsAriaLabel": "{n} {n, plural, one {balise} other {balises}} de plus : {tags}",
"xpack.globalSearchBar.searchBar.placeholder": "Cherchez des applications, du contenu, et plus encore. Ex : Découverte",
"xpack.globalSearchBar.searchBar.shortcutDescription.macCommandDescription": "Commande + /",
"xpack.globalSearchBar.searchBar.shortcutDescription.shortcutDetail": "{shortcutDescription} {commandDescription}",
"xpack.globalSearchBar.searchBar.shortcutDescription.shortcutInstructionDescription": "Raccourci",
"xpack.globalSearchBar.searchBar.shortcutDescription.windowsCommandDescription": "Contrôle + /",
"xpack.globalSearchBar.searchBar.shortcutTooltip.description": "Raccourci clavier",
"xpack.globalSearchBar.searchBar.shortcutTooltip.macCommandDescription": "Commande + /",
"xpack.globalSearchBar.searchBar.shortcutTooltip.windowsCommandDescription": "Contrôle + /",
"xpack.globalSearchBar.suggestions.filterByTagLabel": "Filtrer par nom de balise",
"xpack.globalSearchBar.suggestions.filterByTypeLabel": "Filtrer par type",
"xpack.graph.badge.readOnly.text": "Lecture seule",
"xpack.graph.badge.readOnly.tooltip": "Impossible d'enregistrer les espaces de travail Graph",
"xpack.graph.bar.exploreLabel": "Graph",
"xpack.graph.bar.exploreLabelNoFields": "Sélectionner au moins un champ",
"xpack.graph.bar.exploreLabelNoIndexPattern": "Sélectionner une source de données",
"xpack.graph.bar.pickFieldsLabel": "Ajouter des champs",
"xpack.graph.bar.pickSourceLabel": "Sélectionner une source de données",
"xpack.graph.bar.pickSourceTooltip": "Sélectionner une source de données pour commencer à représenter les relations graphiquement.",
"xpack.graph.bar.searchFieldPlaceholder": "Rechercher vos données et les ajouter au graphe",
"xpack.graph.blocklist.noEntriesDescription": "Aucun terme n'est bloqué. Sélectionnez des sommets et cliquez sur {stopSign} dans le panneau de configuration à droite pour les bloquer. Les documents correspondant aux termes bloqués ne sont plus analysés, et les relations les concernant sont masquées.",
"xpack.graph.blocklist.removeButtonAriaLabel": "Supprimer",
"xpack.graph.clearWorkspace.confirmButtonLabel": "Changer de source de données",
"xpack.graph.clearWorkspace.confirmText": "Si vous changez de source de données, vos champs et sommets actuels sont réinitialisés.",
"xpack.graph.clearWorkspace.modalTitle": "Modifications non enregistrées",
"xpack.graph.drilldowns.description": "Utilisez l'exploration pour créer des liens avec d'autres applications. Les sommets sélectionnés sont intégrés à l'URL.",
"xpack.graph.errorToastTitle": "Erreur dans Graph",
"xpack.graph.exploreGraph.timedOutWarningText": "L'exploration a expiré",
"xpack.graph.fatalError.errorStatusMessage": "Erreur {errStatus} {errStatusText} : {errMessage}",
"xpack.graph.fatalError.unavailableServerErrorMessage": "Échec de connexion d'une requête HTTP. Vérifiez que le serveur Kibana est en cours d'exécution et que votre navigateur dispose d'une connexion opérationnelle, ou contactez votre administrateur système.",
"xpack.graph.featureRegistry.graphFeatureName": "Graph",
"xpack.graph.fieldManager.cancelLabel": "Annuler",
"xpack.graph.fieldManager.colorLabel": "Couleur",
"xpack.graph.fieldManager.deleteFieldLabel": "Désélectionner le champ",
"xpack.graph.fieldManager.deleteFieldTooltipContent": "Arrêt de la recherche de nouveaux sommets pour ce champ. Les sommets existants sont conservés dans le graphe.",
"xpack.graph.fieldManager.disabledFieldBadgeDescription": "Champ {field} désactivé : cliquez pour le configurer. Pour l'activation, cliquer en maintenant la touche Maj enfoncée",
"xpack.graph.fieldManager.disableFieldLabel": "Désactiver le champ",
"xpack.graph.fieldManager.disableFieldTooltipContent": "Désactivez la recherche de sommets pour ce champ. Vous pouvez également cliquer sur le champ en maintenant la touche Maj enfoncée pour le désactiver.",
"xpack.graph.fieldManager.enableFieldLabel": "Activer le champ",
"xpack.graph.fieldManager.enableFieldTooltipContent": "Activez la recherche de sommets pour ce champ. Vous pouvez également cliquer sur le champ en maintenant la touche Maj enfoncée pour l'activer.",
"xpack.graph.fieldManager.fieldBadgeDescription": "Champ {field} : cliquez pour le configurer. Pour la désactivation, cliquer en maintenant la touche Maj enfoncée",
"xpack.graph.fieldManager.fieldLabel": "Champ",
"xpack.graph.fieldManager.fieldSearchPlaceholder": "Filtrer par",
"xpack.graph.fieldManager.iconLabel": "Icône",
"xpack.graph.fieldManager.maxTermsPerHopDescription": "Contrôle le nombre maximum de termes à renvoyer pour chaque étape de recherche.",
"xpack.graph.fieldManager.maxTermsPerHopLabel": "Termes par saut",
"xpack.graph.fieldManager.settingsFormTitle": "Modifier",
"xpack.graph.fieldManager.settingsLabel": "Modifier les paramètres",
"xpack.graph.fieldManager.updateLabel": "Enregistrer les modifications",
"xpack.graph.fillWorkspaceError": "Échec de la récupération des meilleurs termes : {message}",
"xpack.graph.guidancePanel.datasourceItem.indexPatternButtonLabel": "Sélectionnez une source de données.",
"xpack.graph.guidancePanel.fieldsItem.fieldsButtonLabel": "Ajoutez des champs.",
"xpack.graph.guidancePanel.nodesItem.description": "Saisissez une requête dans la barre de recherche pour commencer l'exploration. Vous ne savez pas par où commencer ? {topTerms}.",
"xpack.graph.guidancePanel.nodesItem.topTermsButtonLabel": "Représenter les meilleurs termes dans un graphe",
"xpack.graph.guidancePanel.title": "Obtenir votre graphe en trois étapes",
"xpack.graph.home.breadcrumb": "Graph",
"xpack.graph.icon.areaChart": "Graphique en aires",
"xpack.graph.icon.at": "À",
"xpack.graph.icon.automobile": "Automobile",
"xpack.graph.icon.bank": "Banque",
"xpack.graph.icon.barChart": "Graphique à barres",
"xpack.graph.icon.bolt": "Éclair",
"xpack.graph.icon.cube": "Cube",
"xpack.graph.icon.desktop": "Ordinateur",
"xpack.graph.icon.exclamation": "Exclamation",
"xpack.graph.icon.externalLink": "Lien externe",
"xpack.graph.icon.eye": "Œil",
"xpack.graph.icon.file": "Ficher ouvert",
"xpack.graph.icon.fileText": "Fichier",
"xpack.graph.icon.flag": "Indicateur",
"xpack.graph.icon.folderOpen": "Dossier ouvert",
"xpack.graph.icon.font": "Police",
"xpack.graph.icon.globe": "Globe",
"xpack.graph.icon.google": "Google",
"xpack.graph.icon.heart": "Cœur",
"xpack.graph.icon.home": "Accueil",
"xpack.graph.icon.industry": "Industrie",
"xpack.graph.icon.info": "Infos",
"xpack.graph.icon.key": "Clé",
"xpack.graph.icon.lineChart": "Graphique en courbes",
"xpack.graph.icon.list": "Liste",
"xpack.graph.icon.mapMarker": "Marqueur de carte",
"xpack.graph.icon.music": "Musique",
"xpack.graph.icon.phone": "Téléphone",
Expand Down
Loading