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 initContainer to download model #613

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

lianhao
Copy link
Collaborator

@lianhao lianhao commented Nov 27, 2024

Description

Add initContainer to download model to avoid the permission conflict issue of the .locks directory in the host modeUseHostPath path, when sharing the host model directory between different services.

Issues

n/a.

Type of change

List the type of change like below. Please delete options that are not relevant.

  • New feature (non-breaking change which adds new functionality)

Dependencies

List the newly introduced 3rd party dependency if exists.

Tests

Describe the tests that you ran to verify your changes.

@lianhao lianhao requested a review from yongfengdu as a code owner November 27, 2024 03:24
@lianhao lianhao requested a review from poussa November 27, 2024 03:25
Copy link
Collaborator

@yongfengdu yongfengdu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@eero-t eero-t 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, but also all initContainers need to drop unneeded privileged, and I think all of them to need the file access rights handling, as their actual workloads run under same user ID (1000).

helm-charts/common/speecht5/templates/deployment.yaml Outdated Show resolved Hide resolved
helm-charts/common/speecht5/templates/deployment.yaml Outdated Show resolved Hide resolved
@poussa
Copy link
Collaborator

poussa commented Dec 2, 2024

Has this been tested with k8s volumes with ReadWriteMany where multiple containers update a shared volume? Or is it expected to work similar to the host path case? @lianhao can you comment this?

@lianhao lianhao force-pushed the model-downloader branch 3 times, most recently from 092b755 to 639d67c Compare December 5, 2024 09:59
Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

Some further suggestions to improve security.

@lianhao lianhao force-pushed the model-downloader branch 2 times, most recently from 0efe89e to dffc70b Compare December 6, 2024 04:46
Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

Group ID settings went under wrong securityContext. Otherwise looks fine.

helm-charts/common/speecht5/values.yaml Show resolved Hide resolved
@lianhao lianhao force-pushed the model-downloader branch 2 times, most recently from 55cfcb6 to 9dcc625 Compare December 10, 2024 02:30
Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

Approved!

(Group ID comment could now be moved to a better place though.)

Comment on lines +39 to +51
# Init container sets the downloaded model dir to be group writable, so that container
# can keep its lock file there. This relies on both containers using the same group ID.
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 (with the last change) best place for these comments would be with the runAsGroup check in the deployment's initContainer securityContext, not any more here in values file.

Add initContainer to download model to avoid the permission conflict
issue of the .locks directory in the host modeUseHostPath path, when
sharing the host model directory between different services.

Also always set securityContext in all cases.

Signed-off-by: Lianhao Lu <[email protected]>
Copy link
Collaborator

@Ruoyu-y Ruoyu-y left a comment

Choose a reason for hiding this comment

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

LGTM

@Ruoyu-y Ruoyu-y merged commit 97a9450 into opea-project:main Dec 11, 2024
19 checks passed
@poussa
Copy link
Collaborator

poussa commented Dec 11, 2024

My K8s volume question went unanswered. I guess, I'll be filing issues if it does not work. My bet is that it won't...

@lianhao
Copy link
Collaborator Author

lianhao commented Dec 11, 2024

@poussa I remembered @yongfengdu has tested the PVC case, but only on NFS storage class if I remembered correctly.

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