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

New release - Public Cloud - w48 #14227

Merged
merged 8 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"noMaintenanceLink": "Zukünftige Wartungsarbeiten planen",
"maintenanceLink": "Wartungsarbeiten verwalten und planen",
"networkTitle": "Verwendetes Netzwerk",
"networkLink": "Privates Netzwerk: vRack Nr. {{vrack}}",
"networkLink": "Privates Netzwerk: vRack {{vrack}}",
"networkPublicTitle": "Öffentliches Netzwerk (Internet)",
"priceBillingTitle": "Support und Abrechnung",
"serviceIdLabel": "Dienst-ID",
Expand All @@ -34,5 +34,6 @@
"supportLink": "Support kontaktieren",
"connectionDetailsCertificateLabel": "Zertifikat",
"connectionDetailsCertificateCopyToast": "Das CA-Zertifikat wurde in die Zwischenablage kopiert.",
"connectionDetailsCertificateDownloadToast": "Das CA-Zertifikat wurde hochgeladen."
"connectionDetailsCertificateDownloadToast": "Das CA-Zertifikat wurde hochgeladen.",
"subnetTitle": "Subnetz:"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"supportLink": "Contact support",
"connectionDetailsCertificateLabel": "Certificate",
"connectionDetailsCertificateCopyToast": "The CA certificate has been copied to your clipboard",
"connectionDetailsCertificateDownloadToast": "The CA certificate has been uploaded"
"connectionDetailsCertificateDownloadToast": "The CA certificate has been uploaded",
"subnetTitle": "Subnet:"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"noMaintenanceLink": "Planificar mis operaciones de mantenimiento futuras",
"maintenanceLink": "Gestionar y planificar mis operaciones de mantenimiento",
"networkTitle": "Red utilizada",
"networkLink": "Red privada: vRack n{{vrack}}",
"networkLink": "Red privada: vRack n°{{vrack}}",
"networkPublicTitle": "Red pública (internet)",
"priceBillingTitle": "Soporte y facturación",
"serviceIdLabel": "ID del servicio",
Expand All @@ -34,5 +34,6 @@
"supportLink": "Contactar con el soporte",
"connectionDetailsCertificateLabel": "Certificado",
"connectionDetailsCertificateCopyToast": "El certificado CA se ha copiado en el portapapeles.",
"connectionDetailsCertificateDownloadToast": "Se ha cargado el certificado CA."
"connectionDetailsCertificateDownloadToast": "Se ha cargado el certificado CA.",
"subnetTitle": "Subred:"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"maintenanceLink": "Gérer et plannifier mes maintenances",
"networkTitle": "Réseau utilisé",
"networkPublicTitle": "Réseau public (internet)",
"networkLink": "Réseau privée: vRack n°{{vrack}}",
"networkLink": "Réseau privé : vRack n°{{vrack}}",
"subnetTitle": "Sous-réseau :",
"priceBillingTitle": "Support & Facturation",
"serviceIdLabel": "Id du service",
"serviceIdCopyToast": "L'id du service a été copié",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"maintenanceLink": "Gérer et plannifier mes maintenances",
"networkTitle": "Réseau utilisé",
"networkPublicTitle": "Réseau public (internet)",
"networkLink": "Réseau privée: vRack n°{{vrack}}",
"networkLink": "Réseau privé : vRack n°{{vrack}}",
"subnetTitle": "Sous-réseau :",
"priceBillingTitle": "Support & Facturation",
"serviceIdLabel": "Id du service",
"serviceIdCopyToast": "L'id du service a été copié",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"supportLink": "Contattare il supporto",
"connectionDetailsCertificateLabel": "Certificato",
"connectionDetailsCertificateCopyToast": "Il certificato CA è stato copiato negli appunti",
"connectionDetailsCertificateDownloadToast": "Il certificato CA è stato scaricato"
"connectionDetailsCertificateDownloadToast": "Il certificato CA è stato scaricato",
"subnetTitle": "Sottorete:"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"supportLink": "Skontaktuj się z pomocą techniczną",
"connectionDetailsCertificateLabel": "Certyfikat",
"connectionDetailsCertificateCopyToast": "Certyfikat CA został skopiowany do schowka",
"connectionDetailsCertificateDownloadToast": "Certyfikat CA został pobrany"
"connectionDetailsCertificateDownloadToast": "Certyfikat CA został pobrany",
"subnetTitle": "Podsieć:"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"noMaintenanceLink": "Planear as minhas futuras manutenções",
"maintenanceLink": "Gerir e planear as minhas manutenções",
"networkTitle": "Rede utilizada",
"networkLink": "Rede privada: vRack n°{{vrack}}",
"networkLink": "Rede privada: vRack n.°{{vrack}}",
"networkPublicTitle": "Rede pública (Internet)",
"priceBillingTitle": "Suporte & Faturação",
"serviceIdLabel": "ID do serviço",
Expand All @@ -34,5 +34,6 @@
"supportLink": "Contactar o Apoio ao Cliente",
"connectionDetailsCertificateLabel": "Certificado",
"connectionDetailsCertificateCopyToast": "O certificado CA foi copiado para a área de transferência",
"connectionDetailsCertificateDownloadToast": "O certificado CA foi descarregado"
"connectionDetailsCertificateDownloadToast": "O certificado CA foi descarregado",
"subnetTitle": "Sub-rede:"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Service } from '@/types/cloud/project/database';
import { useGetNetwork } from './useGetNetwork.hook';
import { useGetSubnet } from './useGetSubnet.hook';

export function useGetServiceSubnet(projectId: string, service: Service) {
const privateNetworksQwery = useGetNetwork(projectId);
const network = privateNetworksQwery.data?.find((p) =>
p.regions.find((r) => r.openstackId === service.networkId),
);
const subnetQuery = useGetSubnet(projectId, network?.id, {
enabled: !!network?.id,
});
const subnet = subnetQuery.data?.find((s) => s.id === service.subnetId);
return subnet;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { renderHook, waitFor } from '@testing-library/react';
import { vi } from 'vitest';
import { QueryClientWrapper } from '@/__tests__/helpers/wrappers/QueryClientWrapper';
import {
mockedNetworks,
mockedSubnets,
} from '@/__tests__/helpers/mocks/network';
import { mockedService } from '@/__tests__/helpers/mocks/services';
import { Service } from '@/types/cloud/project/database';
import { useGetServiceSubnet } from './useGetServiceSubnet.hook';
import { useGetNetwork } from './useGetNetwork.hook';
import { useGetSubnet } from './useGetSubnet.hook';

vi.mock('@/data/api/network/network.api', () => ({
networkApi: {
getPrivateNetworks: vi.fn(),
getSubnets: vi.fn(),
},
}));

vi.mock('./useGetNetwork.hook', () => ({
useGetNetwork: vi.fn(),
}));

vi.mock('./useGetSubnet.hook', () => ({
useGetSubnet: vi.fn(),
}));

describe('useGetServiceSubnet', () => {
it('should return the correct subnet', async () => {
const projectId = 'projectId';
const service: Service = {
...mockedService,
networkId: mockedNetworks[0].regions[0].openstackId,
subnetId: mockedSubnets[0].id,
};

vi.mocked(useGetNetwork).mockReturnValue({
data: [mockedNetworks[0]],
isSuccess: true,
} as any);

vi.mocked(useGetSubnet).mockReturnValue({
data: [mockedSubnets[0]],
isSuccess: true,
} as any);

const { result } = renderHook(
() => useGetServiceSubnet(projectId, service),
{
wrapper: QueryClientWrapper,
},
);

await waitFor(() => {
expect(result.current).toEqual(mockedSubnets[0]);
expect(useGetNetwork).toHaveBeenCalledWith(projectId);
expect(useGetSubnet).toHaveBeenCalledWith(
projectId,
mockedNetworks[0].id,
{
enabled: true,
},
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Guides from '@/components/guides/Guides.component';
import { GuideSections } from '@/types/guide';
import { useGetVrack } from '@/hooks/api/network/useGetVrack.hook';
import { useGetMetrics } from '@/hooks/api/database/metric/useGetMetrics.hook';
import { useGetServiceSubnet } from '@/hooks/api/network/useGetServiceSubnet.hook';

interface MetricTile {
name: string;
Expand All @@ -39,6 +40,7 @@ interface MetricTile {
const Dashboard = () => {
const { service, projectId } = useServiceData();
const vrackQuery = useGetVrack(projectId);
const subnet = useGetServiceSubnet(projectId, service);
const metricsQuery = useGetMetrics(projectId, service.engine, service.id);
const toast = useToast();
const { t } = useTranslation(
Expand Down Expand Up @@ -178,27 +180,41 @@ const Dashboard = () => {
<CardContent>
<Maintenance />
<div data-testid="dashboard-vrack-container">
{service.networkType === database.NetworkTypeEnum.private ? (
vrackQuery.isSuccess && (
<div>
<h5 className="py-6">
<ShieldCheck className="size-4 inline mr-2 text-green-500" />
{t('networkTitle')}
</h5>
<div className="flex flex-row gap-1">
<OvhLink
application="dedicated"
path={`#/vrack/${vrackQuery.data.id}`}
>
{service.networkType === database.NetworkTypeEnum.private && (
<div>
<h5 className="py-6">
<ShieldCheck className="size-4 inline mr-2 text-green-500" />
{t('networkTitle')}
</h5>
{vrackQuery.isSuccess ? (
<OvhLink
application="dedicated"
path={`#/vrack/${vrackQuery.data.id}`}
>
<div className="flex flex-row gap-1">
{t('networkLink', {
vrack: vrackQuery.data.id,
})}
</OvhLink>
<ArrowRight className="w-4 h-4 ml-1 mt-1 text-primary" />
</div>
<ArrowRight className="w-4 h-4 ml-1 mt-1 text-primary" />
</div>
</OvhLink>
) : (
<Skeleton className="w-28 h-4" />
)}

<div className="flex flex-row gap-1 items-center">
<b>{t('subnetTitle')}</b>
{subnet ? (
<span>
`${subnet.cidr} - ${subnet.ipPools[0].region}`
</span>
) : (
<Skeleton className="w-28 h-4" />
)}
</div>
)
) : (
</div>
)}
{service.networkType === database.NetworkTypeEnum.public && (
<h5 className="py-6">
<ShieldAlert className="size-4 inline mr-2 text-amber-400" />
{t('networkPublicTitle')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const useAdvancedConfigurationForm = ({
case database.capabilities.advancedConfiguration.property.TypeEnum.string:
return property.values
? z.enum(property.values as [string, ...string[]])
: z.string().min(1, t('advancedConfigurationErrorRequired'));
: z.string();
default:
return z.string();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,9 @@
"kube_service_cluster_admission_plugins_always_pull_image_explanation": "Erzwingt, dass jeder neue Pod jedes Mal die benötigten Images herunterlädt.",
"kube_service_cluster_admission_plugins_node_restriction_explanation": "Die Verwendung des Plug-Ins für den NodeRestriction-Zugangscontroller schränkt die Node- und POD-Objekte ein, die ein Kubelet ändern kann. Wenn sie durch diesen Zugangscontroller eingeschränkt sind, dürfen Kubelets nur ihr eigenes API-Node-Objekt und nur die API-Pod-Objekte ändern, die an ihren Node gebunden sind.",
"kube_service_cluster_admission_plugins_error": "Beim Zurücksetzen Ihres Clusters ist ein Fehler aufgetreten: {{ message }}",
"kube_service_cluster_admission_plugins_success": "Die Änderung der Plugins wurde registriert."
"kube_service_cluster_admission_plugins_success": "Die Änderung der Plugins wurde registriert.",
"kube_service_cluster_etcd_quota": "Verwendung des ETCD-Quotas",
"kube_service_cluster_etcd_quota_info": "Das ETCD-Quota stellt den der ETCD-Datenbank Ihres verwalteten Clusters zugewiesenen Speicherplatz dar.",
"kube_service_etcd_quota_error": "Dieser Cluster verwendet mehr als 80% des zugewiesenen ETCD-Speicherplatzes.",
"kube_service_etcd_quota_error_link": "Wie verwalte ich meine ETCD-Ressourcen?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,9 @@
"kube_service_cluster_admission_plugins_always_pull_image_explanation": "Forces each new pod to download the required images each time.",
"kube_service_cluster_admission_plugins_node_restriction_explanation": "Using the NodeRestriction admission controller plug-in limits the Node and Pod objects that a Kubelet can modify. When throttled by this admission controller, Kubelets are only allowed to modify their own API Node object and only those API Pod objects that are bound to their node.",
"kube_service_cluster_admission_plugins_error": "An error has occurred resetting your cluster: {{ message }}",
"kube_service_cluster_admission_plugins_success": "The Admission Plugins modification has been processed."
"kube_service_cluster_admission_plugins_success": "The Admission Plugins modification has been processed.",
"kube_service_cluster_etcd_quota": "Use of ETCD quota",
"kube_service_cluster_etcd_quota_info": "The ETCD quota represents the space allocated to the ETCD database in your managed cluster.",
"kube_service_etcd_quota_error": "This cluster uses more than 80% of the allocated ETCD space.",
"kube_service_etcd_quota_error_link": "How do I manage my ETCD resources?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,9 @@
"kube_service_cluster_admission_plugins_always_pull_image_explanation": "Fuerza cada nuevo pod a descargar las imágenes necesarias cada vez.",
"kube_service_cluster_admission_plugins_node_restriction_explanation": "El uso del plugin del controlador de admisión NodeRestriction limita los objetos Node y Pod que un kubelet puede modificar. Cuando están limitados por este controlador de admisión, los kubelets solo están autorizados a modificar su propio objeto API Node y únicamente los objetos API Pod asociados a sus nodos.",
"kube_service_cluster_admission_plugins_error": "Se ha producido un error al restaurar el cluster: {{ message }}.",
"kube_service_cluster_admission_plugins_success": "La modificación de los Admission Plugins se ha registrado."
"kube_service_cluster_admission_plugins_success": "La modificación de los Admission Plugins se ha registrado.",
"kube_service_cluster_etcd_quota": "Uso de la cuota ETCD",
"kube_service_cluster_etcd_quota_info": "La cuota ETCD representa el espacio asignado a la base de datos ETCD del clúster administrado.",
"kube_service_etcd_quota_error": "Este clúster usa más del 80% del espacio ETCD asignado.",
"kube_service_etcd_quota_error_link": "¿Cómo gestionar mis recursos ETCD?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
"kube_service_cluster_network_vrack_default_gateway": "Passerelle par défaut du vRACK (DHCP)",
"kube_service_cluster_network_vrack_customer_gateway": "Passerelle : {{ vRackGatewayIp }}",
"kubernetes_add_private_network": "Configurer un réseau",

"kube_service_network_edit": "Modifier les paramètres du réseau"
"kube_service_network_edit": "Modifier les paramètres du réseau",
"kube_service_cluster_etcd_quota": "Utilisation du quota ETCD",
"kube_service_cluster_etcd_quota_info": "Le quota ETCD représente l'espace alloué à la base de donnée ETCD de votre cluster managé.",
"kube_service_etcd_quota_error": "Ce cluster utilise plus de 80% de l'espace ETCD attribué.",
"kube_service_etcd_quota_error_link": "Comment gérer mes ressources ETCD ?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
"kube_service_cluster_network_vrack_default_gateway": "Passerelle par défaut du vRACK (DHCP)",
"kube_service_cluster_network_vrack_customer_gateway": "Passerelle : {{ vRackGatewayIp }}",
"kubernetes_add_private_network": "Configurer un réseau",

"kube_service_network_edit": "Modifier les paramètres du réseau"
"kube_service_network_edit": "Modifier les paramètres du réseau",
"kube_service_cluster_etcd_quota": "Utilisation du quota ETCD",
"kube_service_cluster_etcd_quota_info": "Le quota ETCD représente l'espace alloué à la base de donnée ETCD de votre cluster managé.",
"kube_service_etcd_quota_error": "Ce cluster utilise plus de 80% de l'espace ETCD attribué.",
"kube_service_etcd_quota_error_link": "Comment gérer mes ressources ETCD ?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"kube_service_cluster_network_subnet": "Sottorete",
"kube_service_cluster_network_lb_subnet": "Sottorete Load Balancer",
"kube_service_cluster_network_error": "Si è verificato un errore durante il caricamento delle informazioni di rete: {{ error }}",
"kube_service_network_edit": "Modificare i parametri della rete",
"kube_service_network_edit": "Modificare le impostazioni di rete",
"kubernetes_add_private_network": "Configurare una rete",
"kube_service_cluster_admission_plugins": "Admission Plugins",
"kube_service_cluster_admission_plugins_mutation": "Attivare/disattivare i plugin",
Expand All @@ -93,5 +93,9 @@
"kube_service_cluster_admission_plugins_always_pull_image_explanation": "Forza ogni nuovo pod a scaricare le immagini necessarie ogni volta.",
"kube_service_cluster_admission_plugins_node_restriction_explanation": "L'utilizzo del plugin del controller di ammissione NodeRestriction limita gli oggetti Node e Pod che un kubelet può modificare. Quando sono limitati da questo controller di ammissione, i kubelet sono autorizzati a modificare solo il proprio oggetto API Node ed esclusivamente gli oggetti API Pod associati al loro nodo.",
"kube_service_cluster_admission_plugins_error": "Si è verificato un errore durante il ripristino del cluster: {{ message }}",
"kube_service_cluster_admission_plugins_success": "La modifica degli Admission Plugins è stata presa in carico."
"kube_service_cluster_admission_plugins_success": "La modifica degli Admission Plugins è stata presa in carico.",
"kube_service_cluster_etcd_quota": "Utilizzo della quota ETCD",
"kube_service_cluster_etcd_quota_info": "La quota ETCD rappresenta lo spazio assegnato al database ETCD del cluster gestito.",
"kube_service_etcd_quota_error": "Questo cluster utilizza oltre l'80% dello spazio ETCD assegnato.",
"kube_service_etcd_quota_error_link": "Come si gestiscono le risorse ETCD?"
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,9 @@
"kube_service_cluster_admission_plugins_always_pull_image_explanation": "Wprowadź regułę, zgodnie z którą każdy nowy pod zawsze pobiera wymagane obrazy.",
"kube_service_cluster_admission_plugins_node_restriction_explanation": "Użycie wtyczki kontrolera dostępu NodeRestriction ogranicza obiekty Node i Pod, które kubelet może modyfikować. Gdy obiekty te są ograniczone przez kontroler dostępu, kublety mogą modyfikować tylko własny obiekt API Node i tylko obiekty API Pod powiązane z ich węzłem.",
"kube_service_cluster_admission_plugins_error": "Wystąpił błąd podczas resetu klastra: {{ message }}.",
"kube_service_cluster_admission_plugins_success": "Dyspozycja modyfikacji Admission Plugins została przyjęta."
"kube_service_cluster_admission_plugins_success": "Dyspozycja modyfikacji Admission Plugins została przyjęta.",
"kube_service_cluster_etcd_quota": "Wykorzystanie limitu ETCD",
"kube_service_cluster_etcd_quota_info": "Rozmiar ETCD to przestrzeń przydzielona do bazy danych ETCD zarządzanego klastra.",
"kube_service_etcd_quota_error": "Ten klaster zużywa ponad 80% przydzielonego miejsca ETCD.",
"kube_service_etcd_quota_error_link": "Jak zarządzać zasobami ETCD?"
}
Loading
Loading