Skip to content

Implement yaml extensions overwriting the default pod/container spec#75

Merged
nikola-jokic merged 22 commits intomainfrom
nikola-jokic/yaml-extension
Sep 25, 2023
Merged

Implement yaml extensions overwriting the default pod/container spec#75
nikola-jokic merged 22 commits intomainfrom
nikola-jokic/yaml-extension

Conversation

@nikola-jokic
Copy link
Copy Markdown
Collaborator

@nikola-jokic nikola-jokic commented Apr 24, 2023

Implements ADR

Comment thread packages/k8s/tests/k8s-utils-test.ts Fixed
@fhammerl
Copy link
Copy Markdown
Contributor

When running docker hooks with {...} options, or k8s hooks with a string options, options is ignored as it cannot be parsed.
Write to logs when options is ignored.

Comment thread packages/k8s/src/k8s/utils.ts
Comment thread packages/k8s/src/k8s/utils.ts
@cjreyn
Copy link
Copy Markdown

cjreyn commented Aug 3, 2023

Hi. Is there any ETA for this PR to be merged? We're eagerly awaiting it as I understand it will allow us to request K8s resources such as GPUs for the build jobs.

@nikola-jokic nikola-jokic marked this pull request as ready for review August 31, 2023 08:08
@nikola-jokic nikola-jokic requested review from a team as code owners August 31, 2023 08:08
Copy link
Copy Markdown
Contributor

@fhammerl fhammerl left a comment

Choose a reason for hiding this comment

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

Let's add an example .yaml that shows some possible overrides

@fhammerl fhammerl dismissed their stale review September 18, 2023 09:57

Let's add it under ADR PR

Comment thread packages/k8s/tests/run-container-step-test.ts
expect(exitCode).toBe(0)
})

it('should run pod with extensions applied', async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

leave a // explaining that we only assert successful run here not individual overrides

]
} as k8s.V1Container

const from = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: maybe from -> extension

Comment thread packages/k8s/src/k8s/utils.ts
): void {
for (const [key, value] of Object.entries(from)) {
if (key === 'containers') {
base.containers.push(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: extract function mergeContainers like a few lines below with mergeLists ?

Comment thread examples/extension.yaml
@@ -0,0 +1,30 @@
metadata:
Copy link
Copy Markdown
Contributor

@fhammerl fhammerl Sep 25, 2023

Choose a reason for hiding this comment

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

NIT: comments indicating section by section if it's an 'replace' or a 'merge'?

No need if the ADR explains it

Comment thread packages/k8s/src/k8s/index.ts
Copy link
Copy Markdown
Contributor

@fhammerl fhammerl left a comment

Choose a reason for hiding this comment

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

LGTM!

@nikola-jokic nikola-jokic merged commit 4cdcf09 into main Sep 25, 2023
@nikola-jokic nikola-jokic deleted the nikola-jokic/yaml-extension branch September 25, 2023 09:49
@cjreyn
Copy link
Copy Markdown

cjreyn commented Sep 25, 2023

A huge thanks for your work on this! We plan on using it for a build farm at Diamond Light Source (the UK's national synchrotron). So you are directly helping us with valuable scientific research into batteries, drugs for cancer, and materials science for renewables.

@nikola-jokic
Copy link
Copy Markdown
Collaborator Author

Hey @cjreyn,

Sorry that we did not respond earlier! Thank you for using the container hook and having interest in it! We are glad if it helps you with your work!

@nielstenboom
Copy link
Copy Markdown
Contributor

Happy to see this merged! Seems you went with the template file after all 😉

I'll close my PR here: #50

Are there also plans for integrating this change in the actions-runner-controller downstream? We internally would love to move away from our current complex fork 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants