Skip to content

Commit 7d62015

Browse files
committed
fix: restructure code for detecting supported workloads
Allows us to extend it and add checks for other workload types.
1 parent 40f6cab commit 7d62015

File tree

1 file changed

+10
-3
lines changed
  • src/supervisor/watchers/handlers

1 file changed

+10
-3
lines changed

src/supervisor/watchers/handlers/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,17 @@ async function isSupportedWorkload(
125125
namespace: string,
126126
workloadKind: WorkloadKind,
127127
): Promise<boolean> {
128-
if (workloadKind !== WorkloadKind.DeploymentConfig) {
129-
return true;
128+
switch (workloadKind) {
129+
case WorkloadKind.DeploymentConfig:
130+
return await isDeploymentConfigSupported(namespace);
131+
default:
132+
return true;
130133
}
134+
}
131135

136+
async function isDeploymentConfigSupported(
137+
namespace: string,
138+
): Promise<boolean> {
132139
try {
133140
const pretty = undefined;
134141
const continueToken = undefined;
@@ -162,7 +169,7 @@ async function isSupportedWorkload(
162169
);
163170
} catch (error) {
164171
logger.debug(
165-
{ error, workloadKind },
172+
{ error, workloadKind: WorkloadKind.DeploymentConfig },
166173
'Failed on Kubernetes API call to list DeploymentConfig',
167174
);
168175
return false;

0 commit comments

Comments
 (0)