Skip to content

Commit

Permalink
fix: remote config validation not working (#967)
Browse files Browse the repository at this point in the history
Signed-off-by: instamenta <instamenta@abv.bg>
  • Loading branch information
instamenta authored Dec 10, 2024
1 parent d070191 commit 88c2506
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
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 @@ export class NetworkCommand extends BaseCommand {
);

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

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

0 comments on commit 88c2506

Please sign in to comment.