Skip to content

feat: add mfe-k8s-volume-mounts patch - #267

Merged
ahmed-arb merged 1 commit into
overhangio:releasefrom
eduNEXT:afg/volume-mounts-patch
Sep 15, 2025
Merged

feat: add mfe-k8s-volume-mounts patch#267
ahmed-arb merged 1 commit into
overhangio:releasefrom
eduNEXT:afg/volume-mounts-patch

Conversation

@Ang-m4

@Ang-m4 Ang-m4 commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request introduces a new patch, mfe-k8s-volume-mounts, to improve how custom volumes are mounted in the MFE Kubernetes deployment. Now that the host extra file changes were applied at #264, I noticed that there was no patch referencing the volume mounts, which prevented the mfe-k8s-volumes patch from actually being applied in Kubernetes environments.

The documentation has been updated to guide users on defining and mounting volumes using the new patch, and a changelog entry records the addition.

Note

This patch is necessary for mfe-k8s-volumes to work properly, as the corresponding volume mount patch was previously missing.

For further information about the importance of this PR, please take a look at: feat: add volume patches to mfe service and k8s #264

Changes

  • Added the mfe-k8s-volume-mounts patch to allow mounting custom volumes (such as ConfigMaps or PVCs) into the mfe container in Kubernetes deployments, complementing the existing mfe-k8s-volumes patch. (tutormfe/patches/k8s-deployments)
  • Updated the documentation to explain how to use both mfe-k8s-volumes and mfe-k8s-volume-mounts together, including a practical example for mounting a ConfigMap.
  • Added a new section in the documentation describing the purpose and usage of the mfe-k8s-volume-mounts patch. (README.rst)

@Ang-m4

Ang-m4 commented Sep 1, 2025

Copy link
Copy Markdown
Contributor Author

Hi @arbrandes, @DawoudSheraz, @brian-smith-tcril.

While working with the new tutor-mfe host extra files feature, I realized that there was a missing patch in the Kubernetes deployment. Without it, the extra files defined through mfe-k8s-volumes couldn’t actually be mounted inside the mfe container.

This PR adds the mfe-k8s-volume-mounts patch to complete the functionality, so that extra files can be properly injected into the pod and served by Caddy.

Please let me know what you think!

name: config
{%- if MFE_HOST_EXTRA_FILES %}
{{ patch("mfe-k8s-volume-mounts") | indent(12) }}
{%- endif %}

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.

Can mfe-k8s-volume-mounts and mfe-k8s-volumes be merged in a single patch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@DawoudSheraz, thanks for your quick review!

I don’t think it’s really possible to unify them, since the volumes and volumeMounts blocks live in different parts of the Deployment spec. Each patch hook only injects into a single position, so combining them wouldn’t work. Also, they cover two different concerns, so keeping them separate helps maintain a clear separation of responsibilities.

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.

Hmm. If you look at deployments.yml template in tutor, it has a k8s-deployments patch applied at the end of file (https://github.com/overhangio/tutor/blob/release/tutor/templates/k8s/deployments.yml#L483). The idea is that if one wants to customize the deployment, they can do so using this patch. Won't a similar pattern work here? In the new patch, we can define the volume and volume mount. Sorry if I am missing some k8s technical context here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@DawoudSheraz The pattern you mentioned is designed for injecting complete resources through patches like k8s-deployments. That works when we’re defining entire Deployments or sections of the spec, but here, our goal is simply to add to the MFE deployment.

The two patches target different parts of the Deployment spec:

  • mfe-k8s-volumes injects volume definitions under spec.template.spec.volumes
  • mfe-k8s-volume-mounts injects mounts under spec.template.spec.containers[].volumeMounts

A merge could theoretically work if the sections were adjacent but we have the config volume defined in between.
Even if they were next to each other, they still require different indentation and context (one at the pod level, the other inside a container).

It would be ideal to declare volumes and mount them together, but given Kubernetes’s structure, it’s necessary to keep them separated.

Let me know if I’ve captured your idea correctly, or if there’s anything else you’d like to comment on!

@DawoudSheraz DawoudSheraz moved this from Pending Triage to In Progress in Tutor project management Sep 2, 2025
@DawoudSheraz DawoudSheraz moved this from In Progress to In review in Tutor project management Sep 2, 2025
@ahmed-arb
ahmed-arb merged commit 20b6af4 into overhangio:release Sep 15, 2025
3 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Tutor project management Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants