Skip to content

Commit 9c08163

Browse files
committed
fix: revert checking for parent workloads being controllers
This reverts the change in 07f4f34. DeploymentConfigs on OpenShift create ReplicationControllers which in turn create Pods. However, the ReplicationControllers in this case are not marked as controllers, hence we cannot walk the list of owner references and can never scan DeploymentConfigs. This change ensures we do not strictly check for controllers to allow us to read DeploymentConfigs.
1 parent 3b9c842 commit 9c08163

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/supervisor/workload-reader.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ export function getWorkloadReader(workloadType: string): IWorkloadReaderFunc {
224224

225225
export function getSupportedWorkload(ownerRefs: V1OwnerReference[] | undefined): V1OwnerReference | undefined {
226226
return ownerRefs !== undefined
227-
? ownerRefs.find(
228-
(owner) =>
229-
SupportedWorkloadTypes.includes(owner.kind) &&
230-
owner.controller === true,
231-
)
227+
? ownerRefs.find((owner) => SupportedWorkloadTypes.includes(owner.kind))
232228
: undefined;
233229
}

test/unit/supervisor/workload-reader.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ describe('workload reader tests', () => {
2929
getSupportedWorkload(unsupportedOwnerRefs as V1OwnerReference[]),
3030
).toBeUndefined();
3131

32+
// Selects the first one that matches a supported workload
3233
const noController = [{ kind: 'ReplicaSet' }, { kind: 'Deployment' }];
33-
expect(
34-
getSupportedWorkload(noController as V1OwnerReference[]),
35-
).toBeUndefined();
34+
expect(getSupportedWorkload(noController as V1OwnerReference[])).toEqual({
35+
kind: 'ReplicaSet',
36+
});
3637

38+
// Selects the first one that matches a supported workload, regardless of controllers
3739
const oneController = [
3840
{ kind: 'ReplicaSet' },
3941
{ kind: 'Deployment', controller: true },
4042
];
4143
expect(getSupportedWorkload(oneController as V1OwnerReference[])).toEqual({
42-
kind: 'Deployment',
43-
controller: true,
44+
kind: 'ReplicaSet',
4445
});
4546

4647
const twoControllers = [

0 commit comments

Comments
 (0)