diff --git a/plugins/aks-desktop/src/components/Deploy/DeployButton.tsx b/plugins/aks-desktop/src/components/Deploy/DeployButton.tsx
index 7b8fcb5bf..f392f4c85 100644
--- a/plugins/aks-desktop/src/components/Deploy/DeployButton.tsx
+++ b/plugins/aks-desktop/src/components/Deploy/DeployButton.tsx
@@ -5,6 +5,8 @@ import { Icon } from '@iconify/react';
import { useTranslation } from '@kinvolk/headlamp-plugin/lib';
import { Button, Dialog } from '@mui/material';
import React, { useEffect } from 'react';
+import { useAzureContext } from '../../hooks/useAzureContext';
+import { useNamespaceCapabilities } from '../../hooks/useNamespaceCapabilities';
import DeployWizard from '../DeployWizard/DeployWizard';
import { useDeployUrlParams } from './hooks/useDeployUrlParams';
import { useDialogState } from './hooks/useDialogState';
@@ -41,6 +43,15 @@ function DeployButton({ project }: DeployButtonProps) {
const { t } = useTranslation();
const urlParams = useDeployUrlParams();
const dialogState = useDialogState();
+ const cluster = project.clusters?.[0] || undefined;
+ const namespace = project.namespaces?.[0] || undefined;
+ const { azureContext, error: azureContextError } = useAzureContext(cluster);
+ const { isManagedNamespace, azureRbacEnabled } = useNamespaceCapabilities({
+ subscriptionId: azureContext?.subscriptionId,
+ resourceGroup: azureContext?.resourceGroup,
+ clusterName: cluster,
+ namespace: namespace ?? '',
+ });
// Open dialog when URL parameters indicate we should
useEffect(() => {
@@ -91,10 +102,22 @@ function DeployButton({ project }: DeployButtonProps) {
}}
>
>
diff --git a/plugins/aks-desktop/src/components/DeployWizard/DeployWizard.tsx b/plugins/aks-desktop/src/components/DeployWizard/DeployWizard.tsx
index 679f23069..d2b1c0872 100644
--- a/plugins/aks-desktop/src/components/DeployWizard/DeployWizard.tsx
+++ b/plugins/aks-desktop/src/components/DeployWizard/DeployWizard.tsx
@@ -24,6 +24,8 @@ type DeployWizardProps = {
onClose?: () => void;
/** Azure context for workload identity setup */
azureContext?: DeployAzureContext;
+ /** Error message from resolving the Azure context, if any. */
+ azureContextError?: string;
};
/**
@@ -71,6 +73,7 @@ export default function DeployWizard(props: DeployWizardProps) {
)}
diff --git a/plugins/aks-desktop/src/components/DeployWizard/components/ConfigureContainer.tsx b/plugins/aks-desktop/src/components/DeployWizard/components/ConfigureContainer.tsx
index bbe856744..7204c9034 100644
--- a/plugins/aks-desktop/src/components/DeployWizard/components/ConfigureContainer.tsx
+++ b/plugins/aks-desktop/src/components/DeployWizard/components/ConfigureContainer.tsx
@@ -22,8 +22,9 @@ interface ConfigureContainerProps {
};
/** When false, containerImage is not required to proceed past the Basics step. Default: true. */
requireContainerImage?: boolean;
- /** Azure context needed for workload identity setup */
azureContext?: DeployAzureContext;
+ /** Error message from resolving the Azure context, if any. */
+ azureContextError?: string;
/** Target namespace for workload identity setup */
namespace?: string;
}
@@ -32,6 +33,7 @@ export default function ConfigureContainer({
containerConfig,
requireContainerImage = true,
azureContext,
+ azureContextError,
namespace,
}: ConfigureContainerProps) {
const { t } = useTranslation();
@@ -93,6 +95,7 @@ export default function ConfigureContainer({
diff --git a/plugins/aks-desktop/src/components/DeployWizard/components/WorkloadIdentityStep.tsx b/plugins/aks-desktop/src/components/DeployWizard/components/WorkloadIdentityStep.tsx
index 363071750..9fa4c5c40 100644
--- a/plugins/aks-desktop/src/components/DeployWizard/components/WorkloadIdentityStep.tsx
+++ b/plugins/aks-desktop/src/components/DeployWizard/components/WorkloadIdentityStep.tsx
@@ -34,12 +34,15 @@ import {
interface WorkloadIdentityStepProps {
containerConfig: ContainerConfigProp;
azureContext?: DeployAzureContext;
+ /** Error message from resolving the Azure context, if any. */
+ azureContextError?: string;
namespace?: string;
}
export default function WorkloadIdentityStep({
containerConfig,
azureContext,
+ azureContextError,
namespace,
}: WorkloadIdentityStepProps) {
const { t } = useTranslation();
@@ -116,7 +119,7 @@ export default function WorkloadIdentityStep({
/>
{!azureContext && (
- {t('Azure sign-in is required to configure workload identity.')}
+ {azureContextError ?? t('Azure sign-in is required to configure workload identity.')}
)}
{containerConfig.config.enableWorkloadIdentity && azureContext && (