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

fix: remote config validation not working #967

Merged
merged 1 commit into from
Dec 10, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@
);

remoteConfig.components.add(
`envoy-${nodeAlias}`,
new EnvoyProxyComponent(`envoy-${nodeAlias}`, cluster, namespace),
`envoy-proxy-${nodeAlias}`,
new EnvoyProxyComponent(`envoy-proxy-${nodeAlias}`, cluster, namespace),

Check warning on line 780 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L779-L780

Added lines #L779 - L780 were not covered by tests
);

remoteConfig.components.add(
Expand Down
12 changes: 6 additions & 6 deletions src/core/config/remote/remote_config_validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export class RemoteConfigValidator {
private static validateHaProxies(components: ComponentsDataWrapper, k8: K8): Promise<void>[] {
return Object.values(components.haProxies).map(async component => {
try {
const pod = await k8.getPodByName(component.name);
const pods = await k8.getPodsByLabel([`app=${component.name}`]);

// to return the generic error message
if (!pod) throw new Error('Pod not found');
if (!pods.length) throw new Error('Pod not found');
} catch (e) {
RemoteConfigValidator.throwValidationError('HaProxy', component, e);
}
Expand All @@ -86,10 +86,10 @@ export class RemoteConfigValidator {
private static validateEnvoyProxies(components: ComponentsDataWrapper, k8: K8): Promise<void>[] {
return Object.values(components.envoyProxies).map(async component => {
try {
const pod = await k8.getPodByName(component.name);
const pods = await k8.getPodsByLabel([`app=${component.name}`]);

// to return the generic error message
if (!pod) throw new Error('Pod not found');
if (!pods.length) throw new Error('Pod not found');
} catch (e) {
RemoteConfigValidator.throwValidationError('Envoy proxy', component, e);
}
Expand All @@ -99,10 +99,10 @@ export class RemoteConfigValidator {
private static validateConsensusNodes(components: ComponentsDataWrapper, k8: K8): Promise<void>[] {
return Object.values(components.consensusNodes).map(async component => {
try {
const pod = await k8.getPodByName(component.name);
const pods = await k8.getPodsByLabel([`app=network-${component.name}`]);

// to return the generic error message
if (!pod) throw new Error('Pod not found');
if (!pods.length) throw new Error('Pod not found');
} catch (e) {
RemoteConfigValidator.throwValidationError('Consensus node', component, e);
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/integration/core/remote_config_validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('RemoteConfigValidator', () => {
});

it('should succeed if component is present', async () => {
await createPod(haProxyName, {});
await createPod(haProxyName, {app: haProxyName});

// @ts-ignore
await Promise.all(RemoteConfigValidator.validateHaProxies(components, k8));
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('RemoteConfigValidator', () => {
});

it('should succeed if component is present', async () => {
await createPod(envoyProxyName, {});
await createPod(envoyProxyName, {app: envoyProxyName});

// @ts-ignore
await Promise.all(RemoteConfigValidator.validateEnvoyProxies(components, k8));
Expand All @@ -192,7 +192,7 @@ describe('RemoteConfigValidator', () => {
});

it('should succeed if component is present', async () => {
await createPod(nodeAlias, {});
await createPod(nodeAlias, {app: `network-${nodeAlias}`});

// @ts-ignore
await Promise.all(RemoteConfigValidator.validateConsensusNodes(components, k8));
Expand Down
Loading