Skip to content

Commit 4653691

Browse files
Mo MesginMo Mesgin
authored andcommitted
remove logic to detect rancher repos for airgapped env
1 parent b191cc3 commit 4653691

2 files changed

Lines changed: 8 additions & 43 deletions

File tree

shell/store/__tests__/catalog.test.ts

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -523,26 +523,8 @@ describe('catalog', () => {
523523
expect(isRancherRepo(repo, null)).toBe(true);
524524
});
525525

526-
it('should return true if repo is airgapped rancher-charts', () => {
527-
const repo = { type: CATALOG.CLUSTER_REPO, name: 'rancher-charts' } as any;
528-
529-
expect(isRancherRepo(repo, null)).toBe(true);
530-
});
531-
532-
it('should return true if repo is airgapped rancher-partner-charts', () => {
533-
const repo = { type: CATALOG.CLUSTER_REPO, name: 'rancher-partner-charts' } as any;
534-
535-
expect(isRancherRepo(repo, null)).toBe(true);
536-
});
537-
538-
it('should return false if repo is a namespace-scoped rancher-charts', () => {
539-
const repo = { type: CATALOG.REPO, name: 'rancher-charts' } as any;
540-
541-
expect(isRancherRepo(repo, null)).toBe(false);
542-
});
543-
544-
it('should return false for unrelated repo', () => {
545-
const repo = { type: CATALOG.CLUSTER_REPO, name: 'other-repo' } as any;
526+
it('should return false if repo is not a rancher source', () => {
527+
const repo = { isRancherSource: false } as any;
546528

547529
expect(isRancherRepo(repo, null)).toBe(false);
548530
});
@@ -581,26 +563,16 @@ describe('catalog', () => {
581563
});
582564

583565
it('should fallback to LINUX for rancher repos and block windows nodes', () => {
584-
const rancherRepo = { type: CATALOG.CLUSTER_REPO, name: 'rancher-charts' } as any;
585-
const chart = { versions: [{ version: '1.0.0' }] } as any;
586-
587-
chart.isRancherRepo = (isRancherRepo as any)(rancherRepo, chart);
588-
566+
const chart = { isRancherRepo: true, versions: [{ version: '1.0.0' }] } as any;
589567
const versions = compatibleVersionsFor(chart, 'windows');
590568

591-
expect(chart.isRancherRepo).toBe(true);
592569
expect(versions).toHaveLength(0);
593570
});
594571

595572
it('should not fallback to LINUX for non-rancher repos and allow windows nodes', () => {
596-
const nonRancherRepo = { type: CATALOG.REPO, name: 'partner-charts' } as any;
597-
const chart = { versions: [{ version: '1.0.0' }] } as any;
598-
599-
chart.isRancherRepo = (isRancherRepo as any)(nonRancherRepo, chart);
600-
573+
const chart = { isRancherRepo: false, versions: [{ version: '1.0.0' }] } as any;
601574
const versions = compatibleVersionsFor(chart, 'windows');
602575

603-
expect(chart.isRancherRepo).toBe(false);
604576
expect(versions).toHaveLength(1);
605577
});
606578
});

shell/store/catalog.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -792,18 +792,11 @@ export function filterAndArrangeCharts(charts, {
792792
return sortBy(out, ['certifiedSort', 'repoName', 'chartNameDisplay']);
793793
}
794794

795-
/*
796-
Detects if a repository is a Rancher repository.
797-
Airgapped environments often use mirrored registries, meaning `isRancherSource`
798-
will return false because the URL doesn't point to a *.rancher.io domain. We check the repo
799-
names directly to ensure we still correctly identify these mirrored rancher repos.
800-
*/
795+
/**
796+
* Detects if a repository is a Rancher repository.
797+
*/
801798
export function isRancherRepo(repo, chart) {
802-
if (chart?.isRancherRepo || repo?.isRancherSource) {
803-
return true;
804-
}
805-
806-
return repo?.type === CATALOG.CLUSTER_REPO && (repo?.name === 'rancher-charts' || repo?.name === 'rancher-partner-charts');
799+
return !!(chart?.isRancherRepo || repo?.isRancherSource);
807800
}
808801

809802
/**

0 commit comments

Comments
 (0)