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(runJob/kubernetes): use explicit pod name #7039

Merged
merged 2 commits into from May 22, 2019

Conversation

ethanfrogers
Copy link
Contributor

the previous implementation of run job used manifest events to get the
name of the pod created by the job. this proved unreliable as events
roll off quickly in large environments. this commit implements a
PodNameProvider interface which supplies JobManifestPodLogs with the
name of the Pod to fetch logs from. Run Job supplies these Pod names by
collecting all Pods owned by the Job. For components which are still
event based, the JobEventBasedPodNameProvider implements the
previously used logic for getting the Pod name from the event.

@ethanfrogers ethanfrogers added the Do Not Merge Don't merge yet label May 21, 2019
@ethanfrogers ethanfrogers changed the title fix(runJob/kubernetes): use explicit pod name WIP fix(runJob/kubernetes): use explicit pod name May 21, 2019
@ethanfrogers
Copy link
Contributor Author

ethanfrogers commented May 21, 2019

@maggieneterval curious about how you feel about this approach. LMK!

There's a small bit of duplication but I think it's fine given that it's only used in 2 spots.

@maggieneterval
Copy link
Contributor

Hey Ethan, approach seems sane to me! Would love to see a couple tests to help document some of the parsing logic, and maybe just throw your PR description as a comment on the interface sort of explaining why we implemented it?

@ethanfrogers ethanfrogers force-pushed the job-pod-names branch 2 times, most recently from 2b6b690 to ea241e8 Compare May 22, 2019 13:12
@ethanfrogers
Copy link
Contributor Author

@maggieneterval tests added! would you mind giving it another once over for an official review, please :)

@ethanfrogers ethanfrogers removed the Do Not Merge Don't merge yet label May 22, 2019
@ethanfrogers ethanfrogers changed the title WIP fix(runJob/kubernetes): use explicit pod name fix(runJob/kubernetes): use explicit pod name May 22, 2019
Copy link
Contributor

@maggieneterval maggieneterval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"official" (:laughing:) review added :heavy_check_mark:

And thanks for adding the tests!!

}

export class DefaultPodNameProvider implements IPodNameProvider {
public podName: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this can be private?


export class JobEventBasedPodNameProvider implements IPodNameProvider {
public manifest: IManifest;
public manifestEvent: IManifestEvent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe these can be private as well?

import { IManifestEvent, IManifest } from 'core/domain/IManifest';

import { get, trim, bindAll } from 'lodash';
import { bindAll } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh sorry I know you didn't create this file but can you please move the lodash import up to the third-part import block with his friends react etc.? 🙏

@@ -5,15 +5,17 @@ import { IStageManifest, ManifestService } from '../ManifestService';
import { JobManifestPodLogs } from './JobManifestPodLogs';
import { IManifest } from 'core/domain/IManifest';

import { get, template, isEmpty } from 'lodash';
import { get, template, isEmpty, trim } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, lodash misses his BFF react

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣

@@ -8,9 +8,10 @@ import {
} from 'core/pipeline';
import { IPreconfiguredJobParameter } from './preconfiguredJobStage';
import { JobStageExecutionLogs } from 'core/manifest/stage/JobStageExecutionLogs';
import { get } from 'lodash';
import { get, sortBy, last } from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, react is v. lonely by himself in the first block

@@ -61,9 +62,20 @@ export class TitusExecutionLogs extends React.Component<ITitusExecutionLogsProps
}
}

interface IJobOwnedPodStatus {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have this interface twice? Can we just export from one place?

the previous implementation of run job used manifest events to get the
name of the pod created by the job. this proved unreliable as events
roll off quickly in large environments. this commit implements a
`PodNameProvider` interface which supplies `JobManifestPodLogs` with the
name of the Pod to fetch logs from. Run Job supplies these Pod names by
collecting all Pods owned by the Job. For components which are still
event based, the `JobEventBasedPodNameProvider` implements the
previously used logic for getting the Pod name from the event.
@ethanfrogers ethanfrogers merged commit f0287a1 into spinnaker:master May 22, 2019
@ethanfrogers ethanfrogers deleted the job-pod-names branch May 22, 2019 16:32
@ethanfrogers
Copy link
Contributor Author

@spinnakerbot cherry-pick 1.14

@spinnakerbot
Copy link
Contributor

Cherry pick successful: #7047

spinnakerbot pushed a commit that referenced this pull request May 22, 2019
the previous implementation of run job used manifest events to get the
name of the pod created by the job. this proved unreliable as events
roll off quickly in large environments. this commit implements a
`PodNameProvider` interface which supplies `JobManifestPodLogs` with the
name of the Pod to fetch logs from. Run Job supplies these Pod names by
collecting all Pods owned by the Job. For components which are still
event based, the `JobEventBasedPodNameProvider` implements the
previously used logic for getting the Pod name from the event.
anotherchrisberry added a commit that referenced this pull request May 22, 2019
a683832 fix(core): set runAsUser field correctly on triggers (#7048)
f0287a1 fix(runJob/kubernetes): use explicit pod name (#7039)
fc1cd1b fix(core): allow clearing of run as user field in triggers (#7045)
2466379 refactor(core): reactify CRON trigger (#7020)
ethanfrogers pushed a commit that referenced this pull request May 22, 2019
the previous implementation of run job used manifest events to get the
name of the pod created by the job. this proved unreliable as events
roll off quickly in large environments. this commit implements a
`PodNameProvider` interface which supplies `JobManifestPodLogs` with the
name of the Pod to fetch logs from. Run Job supplies these Pod names by
collecting all Pods owned by the Job. For components which are still
event based, the `JobEventBasedPodNameProvider` implements the
previously used logic for getting the Pod name from the event.
maggieneterval added a commit to maggieneterval/deck that referenced this pull request Jun 3, 2019
89e4e78 fix(runJob/kubernetes): reliably display logs (spinnaker#7060)
f0287a1 fix(runJob/kubernetes): use explicit pod name (spinnaker#7039)
3fd183e fix(kubernetes): fix runjob stage init (spinnaker#7029)
4f4c32b feat(provider/kubernetes): namespace deployManifest (spinnaker#7016)
8e97d59 refactor(kubernetes): namespace selector component (spinnaker#7012)
53cb422 refactor(kubernetes): convert deploy manifest stage to react (spinnaker#7002)
0194821 feat(runjob): capture output ui (spinnaker#6978)
maggieneterval added a commit that referenced this pull request Jun 3, 2019
89e4e78 fix(runJob/kubernetes): reliably display logs (#7060)
f0287a1 fix(runJob/kubernetes): use explicit pod name (#7039)
3fd183e fix(kubernetes): fix runjob stage init (#7029)
4f4c32b feat(provider/kubernetes): namespace deployManifest (#7016)
8e97d59 refactor(kubernetes): namespace selector component (#7012)
53cb422 refactor(kubernetes): convert deploy manifest stage to react (#7002)
0194821 feat(runjob): capture output ui (#6978)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants