David Newswanger
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Moving Namespaces into Pulp Ansible ## Problem statement Collection namespaces need to be moved into pulp ansible so that pulp ansible can carry the namespaces API and provide namespace sync functionality. ## Implementation proposal Data model: - Store the existing fields from the galaxy_ng model as database fields - Store the avatar (logo) as as an artifact and keep the hash of the image in the namespace metadata - Note: the namespace serializer will handle creating an image link to the content app for the UI to consume - Will the UI be able to access images on the content app with the redirect content guard? - [mdellweg] Yes, there is a redirect machinery now that works in all cases. But the links will expire after ~2h. - Use a hash of the metadata as the global uniqueness contraint - Use name as the repository uniqueness contraint ```python class Namespace(Content): # fields on the existing model in galaxy_ng name = models.CharField(max_length=64, blank=False) company = models.CharField(max_length=64, blank=True) email = models.CharField(max_length=256, blank=True) description = models.CharField(max_length=256, blank=True) resources = models.TextField(blank=True) # this used to be modelled as a one to many # [mdellweg] Gerrod: "Why not an ArrayField" links = models.JSONField(defaul=[]) # [mdellweg] Can we call this `avatar_sha256`? avatar_hash = models.TextField(blank=True) # Hash of the values of all the fields mentioned above. # Content uniqueness constraint. # [mdellweg] Same here, `metadata_sha256` or just `sha256`? # [mdellweg] We need a stable way to calculate this digest, and blank should be impossible. Maybe we can make this an auto-field. # [Gerrod] Agree with trying to make this an auto-field. metadata_hash = models.TextField(blank=True) def calc_metadata_sha256(self): ... ``` Collection serializer: - Add metadata hash to the collection/collection version serializers so that clients can tell when a namespace is updated and sync it. ```json { "href": "/api/galaxy/v3/plugin/ansible/content/published/collections/index/newswangerd/main_collection/", "name": "main_collection", "namespace": "newswangerd", "namespace_metadata_hash": "xyz...." [...] } ``` Sync pipeline: - For each collection version synced: - Create a new namespace in the repository if one doesn't exist - If the namepace does exist, compare the metadata hash on the remote and the local namespace that's associated with the collection version - if a namespace exists locally with the same hash, associate it with the collection version - if no namespace matches,create a new namespace object from the remote and associate it - [mdellweg] this is exactly the logic the stages provide if the sha256 is the natural key. - Namespaces should only be synced when a collectioning bellonging to it is synced. - Ex: if have `foo.collection` and `bar.collection`, and am only syncing `bar.collection`, then only `bar` should synced, not `foo`. - [mdellweg] Namespaces no longer needed (referenced) in a repository-version should be removed. (finalize can do this wi modify too) ## Notes 2022-10-05: - Namespace metadata needs to be synced as content. - Namespaces still need to get role assignments. - Uniqueness contraints - global - put everything in the uniqueness contraint? - +1 matthias - no uniqueness constraint (might break sync)? - digest of metadata? - more efficient syncing (can serve the namespace digest on the v3 api) - store metadata as jsonb in db and calculate hash - store metadata as an artifact? - hard to search content of artifact - store readme and logo as artifact - per repo - namespace name - Do logos and READMEs change? - yes - We can add their digests in the server answer and on the metadata content model. - Only sync namespaces that have synced collections. - Next up: - Data model ## Discussion ### What are namepaces used for? - Collection ownership. - Users are granted permissions on a namespace that allow them to upload new collections with that given namespace. At the moment permissions are only tracked for groups, not users. So a user has to be part of a group that can upload collections for a given namespace. - Denotes the organization or user that created the collection. - Publisher metadata. - Collection publishers can customize the information on their namespace. This includes: - Adding links to external resources that the publisher may wish to promote - Namespace descriptions - A namespace "readme" markdown file - Company name - Logos/avatars - Contact information ### How are namespaces currently implemented? [Namespace model](https://github.com/ansible/galaxy_ng/blob/master/galaxy_ng/app/models/namespace.py#L57). Namespaces are a global object (ie not part of any repository). They are linked to a `inbound-{namespace_name}` repo where user's are expected to upload collections for the namespace. When users upload collections they are required to upload them to an inbound repo that matches the namespace on the collection. The user's permissions are then checked against the namespace to verify that they have permission to upload the collection. ## Pulp Implementation ### Requirements - Have to be able to maintain the collection ownership model in galaxy - Have to be able to update and create namespace metadata via an api call. - `PUT /v3/namespaces/<name>/` allows users to update all of the namespace information - `POST /v3/namespaces/<name>/` allows users to create new namespaces - Can't break backwards compatibility on the existing namespaces API. ### Possible options #### Convert namespaces to Content Convert the namespace object to a Content type. This will allow namespaces to be synced from remote sources, but will greatly complicate the proces of updating namespace metadata and moving collections between repositories. This is technically possible because even though namespaces don't belong to any repository right now, they are part of the V3 api which is currently scoped to a specific repo, so they can be moved to a repository without breaking changes on the public API. Pros: - Namespace sync - Potential for multitenancy. If namespace ownership is dictated on a per repository basis, then you can have distinct namespaces with distinct owners in each repository. Cons: - Ownership will be very difficult to track. For someone to upload a collection to a repository there will have be a namespace object in that repo that the user has permissions on. #### Leave namespaces as is Move the data model and implement the current galaxy_ng data model as it is. Pros: - Easy Cons: - Namespace sync will be impossible #### Hybrid approach Maintain collection ownership information on a global namespaces object (like it is now) but treat namespace metadata as content. Ownership can't be synced, so it's fine to manage this locally. Pros: - Namespace ownership can be tracked globally - Metadata (logos, description etc) can be synced and tracked separately for each repo. - Collections with the "red_hat" namespace can be synced from community galaxy and cloud automation hub and the upstream vs downstream branding can be maintained separately Cons: - Moving collections between repositories will still be tricky. What do you do if: - a collection moves into a repo that has a different namespace object? - a collection moves into a repo with no matching namespace? ### Considerations - Namespaces are deeply ingrained with permissioning in the galaxy universe. Should this come with a full RBAC implementation in pulp ansible? - The current ownership model will likely need to change with repo management in galaxy_ng. We may not want users to be able to upload collections into any repository if they nave namepace upload rights.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully