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

oss: allow setup mime.types by configmap #1209

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AlbeeSo
Copy link
Member

@AlbeeSo AlbeeSo commented Nov 10, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

allow users setup mime.types with volume scoped, and modify it after CSI startup

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 10, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AlbeeSo
Once this PR has been reviewed and has the lgtm label, please assign mowangdk for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 10, 2024
Copy link
Contributor

@huww98 huww98 left a comment

Choose a reason for hiding this comment

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

I would design the API like this:
Add two per-PV options:

  • mimeVolume: we just pass it through to fuse pod spec.volumes. Should support both hostPath and configMap type volume. The name of configmap should be configurable.
  • mimeSubpath: use this path to access the actual mime.types file in the volume

The current design is not desiable because:

  • If user have too many volumes, the ossfs-mime-config can be very large. It is not scalable.
  • The user cannot reuse the same config for multiple volume, making ossfs-mime-config even larger. And hard to operate.
  • It is hard to authorize config for different volumes to different users (e.g. by RBAC) if we put all of them in the same configMap.


func hasSetMimeConfigMap(volumeId string) bool {
cfg := options.MustGetRestConfig()
clientset := kubernetes.NewForConfigOrDie(cfg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please reuse clientset, for rate-limiter and others to work properly.

func Test_AddDefaultMountOptions(t *testing.T) {
httpmock.Activate()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please try to inject a fake clientset into the tested instance, and avoid modifying global state, to enable parallel test in the future.
And, why not use the fake clientset implemented in client-go?

deploy/chart/templates/rbac.yaml Show resolved Hide resolved
@AlbeeSo
Copy link
Member Author

AlbeeSo commented Nov 13, 2024

I would design the API like this: Add two per-PV options:

  • mimeVolume: we just pass it through to fuse pod spec.volumes. Should support both hostPath and configMap type volume. The name of configmap should be configurable.
  • mimeSubpath: use this path to access the actual mime.types file in the volume

The current design is not desiable because:

  • If user have too many volumes, the ossfs-mime-config can be very large. It is not scalable.
  • The user cannot reuse the same config for multiple volume, making ossfs-mime-config even larger. And hard to operate.
  • It is hard to authorize config for different volumes to different users (e.g. by RBAC) if we put all of them in the same configMap.

sounds great. but i think a entire volume config is a little bit hard to config? maybe we can just support the configmap way to set up the mime.types. users can just specify the name of cm, then CSI convert the map of data to standard format for mime.types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants