Self-Managed administrators define lasting custom <iframe> providers
What does this MR do?
Propagate config for admin-defined <iframe> providers. global.appConfig.iframeProviders is rendered into the gitlab.yml of webservice, Sidekiq and toolbox, where Self-Managed administrators define lasting cust... (gitlab-org/gitlab!271233 - merged) reads it.
Note the feature itself is FF'd and pre-GA.
Validation on a real cluster
I validated this end-to-end on a local k3s cluster (Caproni), deploying this branch against the v19.5.5 images:
-
Deploy this branch with providers set, pinning
global.gitlabVersionto the images you're already running:global: gitlabVersion: v19.5.5 appConfig: iframeProviders: openstreetmap: name: OpenStreetMap matches: - host: www.openstreetmap.org path: /export/embed.html params: [bbox] src: https://www.openstreetmap.org/export/embed.html?bbox={bbox} view: https://www.openstreetmap.org/export/embed.html?bbox={bbox} sandbox: [allow-scripts, allow-same-origin] require_activation: false youtube: name: YouTube (click to load) matches: - host: www.youtube.com path: /embed/{v} - host: www.youtube.com path: /watch params: [v] - host: youtu.be path: /{v} src: https://www.youtube.com/embed/{v} view: https://www.youtube.com/watch?v={v} sandbox: [allow-scripts, allow-same-origin] require_activation: true -
Each of the three ConfigMaps renders the providers:
$ for cm in gitlab-webservice gitlab-sidekiq gitlab-toolbox; do kubectl -n gitlab get configmap $cm -o json | jq -r '.data["gitlab.yml.erb"]' | grep -c 'iframe_providers:'; done 1 1 1 -
Wait for the rollouts to finish (
exec deploy/…can otherwise land on an old pod), then check thegitlab.ymlCNG rendered in each pod parses with both providers. For toolbox:$ kubectl -n gitlab exec deploy/gitlab-toolbox -c toolbox -- ruby -ryaml -rjson -e 'p = YAML.safe_load(File.read("/srv/gitlab/config/gitlab.yml"), aliases: true)["production"]["gitlab"]["iframe_providers"]; puts p.keys.inspect; puts JSON.generate(p["openstreetmap"]["sandbox"]); puts p["youtube"]["view"]' ["openstreetmap", "youtube"] ["allow-scripts","allow-same-origin"] https://www.youtube.com/watch?v={v}Webservice (
-c webservice) and Sidekiq (-c sidekiq) give the same output. -
Run gitlab-org/gitlab!271233 (merged) against that
gitlab.yml. Released images ignore the key, so this needs the monolith MR; I used Caproni's edit mode, which copiesgitlab.ymlfrom the webservice pod. Then:- Admin → Settings → General → Embedded content lists "YouTube (click to load)", Figma and OpenStreetMap.
- Once OpenStreetMap and YouTube are enabled there,
gon.iframe_rendering_providerson any page has both, with YouTube'srequire_activation: trueand narrower sandbox. - Markdown containing
https://www.openstreetmap.org/export/embed.html?bbox=-0.1,51.5,-0.09,51.51andhttps://www.youtube.com/watch?v=12yWKw1AdKYas images renders as two embeds, with provider IDsopenstreetmapandyoutube.
Related issues
- <iframe> embeds in Markdown content (gitlab-org/gitlab#282443) — the feature work item.
- Self-Managed administrators define lasting cust... (gitlab-org/gitlab!271233 - merged) — the monolith-side MR to merge these in, including docs.
- Self-Managed administrators define lasting cust... (gitlab-org/omnibus-gitlab!10105 - merged) — the Omnibus-side MR to provide these settings.
Author checklist
For general guidance, please follow our Contributing guide.
Required
For anything in this list which will not be completed, please provide a reason in the MR discussion.
- Merge Request Title and Description are up to date, accurate, and descriptive.
- MR targeting the appropriate branch.
- MR has a green pipeline.
- Documentation created/updated.
- Tests added/updated.
- Have you validated that your change works end-to-end on a real cluster deployment?
- Describe how you did it in a comment.
- Equivalent MR/issue for omnibus-gitlab opened: Self-Managed administrators define lasting cust... (gitlab-org/omnibus-gitlab!10105 - merged).
- When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.
Reviewers checklist
- As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
- MR has a green pipeline on https://gitlab.com/gitlab-org/charts/gitlab.
- Consider downstream impact to the Operator, as per evaluating impact from changes to GitLab chart.