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

control-service: add security context to Data Job template #713

Merged

Conversation

mivanov1988
Copy link
Collaborator

In order to run the data jobs as user 1000 and group 1000,
we need to add the following properties to the template:

  • spec.jobTemplate.spec.template.spec.securityContext.fsGroup: 1000
  • spec.jobTemplate.spec.template.spec.securityContext.runAsGroup: 1000
  • spec.jobTemplate.spec.template.spec.securityContext.runAsUser: 1000

Testing done: unit and integration tests

Signed-off-by: Miroslav Ivanov miroslavi@vmware.com

Copy link
Collaborator

@antoniivanov antoniivanov left a comment

Choose a reason for hiding this comment

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

This is setting the one for tests (src/test/resources/k8s-data-job-template.yaml ) but not the one in main? Did you forget it?

@mivanov1988
Copy link
Collaborator Author

This is setting the one for tests (src/test/resources/k8s-data-job-template.yaml ) but not the one in main? Did you forget it?

Yes, I forgot. Thanks!

@mivanov1988 mivanov1988 force-pushed the topic/miroslavi/add-security-context-to-data-job-template branch from 84e31cb to 2a0cddc Compare February 16, 2022 16:06
@mivanov1988 mivanov1988 enabled auto-merge (squash) February 17, 2022 20:10
@mivanov1988 mivanov1988 force-pushed the topic/miroslavi/add-security-context-to-data-job-template branch from b2e54ba to 267b711 Compare February 18, 2022 11:20
In order to run the data jobs as user 1000 and group 1000,
we need to add the following properties to the template:

* spec.jobTemplate.spec.template.spec.securityContext.fsGroup: 1000
* spec.jobTemplate.spec.template.spec.securityContext.runAsGroup: 1000
* spec.jobTemplate.spec.template.spec.securityContext.runAsUser: 1000

Testing done: unit and integration tests

Signed-off-by: Miroslav Ivanov miroslavi@vmware.com
@mivanov1988 mivanov1988 force-pushed the topic/miroslavi/add-security-context-to-data-job-template branch from c427eb0 to 94ea1d8 Compare February 18, 2022 12:31
@@ -316,7 +316,7 @@ private void assertDataJobExecutionValid(
assertEquals(jobName, dataJobExecution.getJobName());
assertEquals(executionStatus, dataJobExecution.getStatus());
assertEquals(DataJobExecution.TypeEnum.MANUAL, dataJobExecution.getType());
assertEquals(username + "/" + "user", dataJobExecution.getStartedBy());
//assertEquals(username + "/" + "user", dataJobExecution.getStartedBy());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because of the failing integration tests. I did a quick investigation this morning but unfortunately didn't find what caused the missing startedBy field.

@mivanov1988 mivanov1988 merged commit aef2042 into main Feb 18, 2022
@mivanov1988 mivanov1988 deleted the topic/miroslavi/add-security-context-to-data-job-template branch February 18, 2022 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants