Merge pull request #11611 from torchiaf/11360-azure-limit-k8s-resources-3

Show Unsupported Azure warning message only if Azure is an option
This commit is contained in:
Francesco Torchia 2024-09-05 15:22:17 +02:00 committed by GitHub
commit 6ec92f30e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions

View File

@ -337,10 +337,11 @@ describe('component: rke2', () => {
});
it.each([
['v1.25.0+k3s1', 'azure', true],
['v1.31.0+k3s1', 'harvester', true],
['v1.29.0+k3s1', 'harvester', false],
])('should set isAzureProviderUnsupported', (k8s, cloudProvider, value) => {
['v1.25.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'azure', true],
['v1.31.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'harvester', true],
['v1.29.0+k3s1', [{ value: 'aws' }, { value: 'azure' }], 'harvester', false],
['v1.31.0+k3s1', [{ value: 'aws' }], 'azure', false],
])('should set isAzureProviderUnsupported', (k8s, providerOptions, cloudProvider, value) => {
const wrapper = mount(rke2, {
propsData: {
mode: _CREATE,
@ -353,7 +354,13 @@ describe('component: rke2', () => {
},
provider: 'custom'
},
data: () => ({}),
data: () => ({}),
computed: {
...rke2.computed,
cloudProviderOptions() {
return providerOptions;
},
},
global: {
mocks: {
...defaultMocks,
@ -364,7 +371,7 @@ describe('component: rke2', () => {
}
});
expect((wrapper.vm as any).isAzureProviderUnsupported).toBe(value);
expect(wrapper.vm.isAzureProviderUnsupported).toBe(value);
});
it.each([

View File

@ -652,7 +652,10 @@ export default {
},
isAzureProviderUnsupported() {
return isAzureK8sUnsupported(this.value.spec.kubernetesVersion) || this.agentConfig['cloud-provider-name'] === 'azure';
const isAzureAvailable = !!this.cloudProviderOptions.find((p) => p.value === 'azure');
const isAzureSelected = this.agentConfig['cloud-provider-name'] === 'azure';
return isAzureAvailable && (isAzureK8sUnsupported(this.value.spec.kubernetesVersion) || isAzureSelected);
},
canAzureMigrateOnEdit() {