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

add privileged to host config #47

Merged
merged 1 commit into from
Apr 23, 2024
Merged

add privileged to host config #47

merged 1 commit into from
Apr 23, 2024

Conversation

mfleader
Copy link
Member

Changes introduced with this PR

Add privileged option to deployment host config.


By contributing to this repository, I agree to the contribution guidelines.

@mfleader mfleader self-assigned this Apr 22, 2024
@mfleader mfleader added the enhancement New feature or request label Apr 22, 2024
Copy link

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

Doesn't this PR need the same additions that you did for arcalot/arcaflow-engine-deployer-podman#58?

Copy link

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

Doesn't this PR need the same additions that you did for [...]

I had the same thought, but earlier I didn't try to look. It does seem, however, that the other schema properties are individually referenced and there's no generic mechanism to process them all; so, yeah, I think there should be. (Though it looks very different for docker as it uses a REST API client rather than forking a cli command.)

@mfleader
Copy link
Member Author

mfleader commented Apr 22, 2024

Doesn't this PR need the same additions that you did for [...]

I had the same thought, but earlier I didn't try to look. It does seem, however, that the other schema properties are individually referenced and there's no generic mechanism to process them all; so, yeah, I think there should be. (Though it looks very different for docker as it uses a REST API client rather than forking a cli command.)

Correct, the docker deployer does not use the cli. Instead, it communicates with the docker api through a golang client api. Our docker deployer's config gets unmarshalled into a container.HostConfig struct as the Deployment section of the docker deployer config. The Deployment.HostConfig is passed to the docker golang client, and used to create containers.

Copy link

@webbnh webbnh left a comment

Choose a reason for hiding this comment

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

Our docker deployer's config gets unmarshalled into a container.HostConfig struct as the Deployment section of the docker deployer config.

That's very cool!...but shouldn't this PR include a test which proves that it works? (I.e., which shows that the Privileged field is now accepted?)

Copy link

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

OK, so the schema just gets automagically converted into a Docker HostConfig struct and passed through. Cool, if a bit mysterious.

I agree it would be nice to have tests ... but there's very little testing infrastructure in place and it amounts to a minimal functional test that a container can be deployed and generates output. 😦 I don't like the additional accumulated debt here, but one might also argue that placing the entire burden of building a deployment unit test environment from scratch is a bit much to put on this little PR.

@mfleader
Copy link
Member Author

mfleader commented Apr 23, 2024

Our docker deployer's config gets unmarshalled into a container.HostConfig struct as the Deployment section of the docker deployer config.

That's very cool!...but shouldn't this PR include a test which proves that it works? (I.e., which shows that the Privileged field is now accepted?)

No additional testing is needed because the schema uses StructMappedObjectSchemas for the ContainerConfig and the HostConfig which maps our golang schema structures into the exact config structures used by the container api, container.Config and container.HostConfig, respectively. If the key had been typed as Privilege there would be an error saying the value cannot be set because the Privilege key could not be found because it does not exist in container.HostConfig.

Copy link
Contributor

@jaredoconnell jaredoconnell left a comment

Choose a reason for hiding this comment

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

Looks good. It's good that this field was already present on the structure.

@mfleader mfleader merged commit 8811773 into main Apr 23, 2024
2 checks passed
@mfleader mfleader deleted the privileged branch April 23, 2024 18:41
@webbnh
Copy link

webbnh commented Apr 23, 2024

If the key had been typed as Privilege there would be an error saying the value cannot be set because the Privilege key could not be found because it does not exist in container.HostConfig.

I believe you, but do we have a test which supports that assertion? (Are there tests for NewStructMappedObjectSchema(), in particular with the container.HostConfig specialization? I don't see any tests for the schema.go module.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants