Add egress proxy to user-app Kaniko build jobs.

Inject registry-egress-proxy into Kaniko and network init containers so npm/apk/composer/pip/git clone work on restricted egress clusters.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-07-09 18:07:48 +03:30
parent 3d773a4a62
commit 1ec4d07939
6 changed files with 62 additions and 6 deletions
+25
View File
@@ -137,4 +137,29 @@ describe('BuildService', () => {
expect(dockerfile).toContain('dotnet publish "$CSPROJ"');
});
});
describe('egressProxyEnvFrom', () => {
it('returns secretRef when BUILD_EGRESS_PROXY_SECRET is set', () => {
const config = (service as any).configService as { get: jest.Mock };
config.get.mockImplementation((key: string) => {
if (key === 'build.egressProxySecret') return 'registry-egress-proxy';
return undefined;
});
expect((service as any).egressProxyEnvFrom()).toEqual([
{ secretRef: { name: 'registry-egress-proxy' } },
]);
});
it('returns undefined when egress proxy is disabled', () => {
const config = (service as any).configService as { get: jest.Mock };
config.get.mockImplementation((key: string) => {
if (key === 'build.egressProxySecret') return '';
return undefined;
});
expect((service as any).egressProxyEnvFrom()).toBeUndefined();
expect((service as any).withEgressProxy({ name: 'kaniko' })).toEqual({ name: 'kaniko' });
});
});
});