Page MenuHomePhabricator

[tbs.harbor] Pre-create namespaces
Closed, ResolvedPublic5 Estimated Story Points

Description

We need a way to create the harbor projects for the users to be able to push their images to them.

This can be done beforehand or on-demand. Some ideas:

On-demand

Creating it when the first run is triggered, from the webservice cli

Advantages:

  • Only created when it's actually needed

Disadvantages:

  • Needs credentials to create the project, as it currently is, the cli will need access to those.

Creating it from the validation hook

Advantages:

  • Only created when it's actually needed
  • Secrets remain in the validation hook

Disadvantages:

  • Hand to debug/troubleshoot
  • Delay-sesitive part of the process

Creating it from another (new) service

Advantages:

  • Only created when it's actually needed
  • Secrets remain in the admin side of things
  • This might be the way things should go (thinning the cli and moving to a service)

Disadvantages:

  • New service to maintain (even if it's small)

Beforehand

maintain-kubeusers script [1]:

Advantages:

  • It does not slow down any of the user processes

Disadvantages:

  • It might not have run yet when the user tries to run a build
  • It will create all the projects at once, when most of them might not be needed
  • Might be long and heavy (listing and checking all projects, creating all projects, ~3k tools)

Our own cronjob

Advantages:

  • Clearer separation

Disadvantages:

  • Not reusing mainainkubeusers (not sure how much we can reuse though)

Decision

We decided to go with the dedicated cronjob, as it's the simplest, clearest and does not require exposing any credentials to users.
This entails:

  • Creating the dedicated toolforge tool (maintain-harbor)
  • Create the robot account with "powers" to create the namespaces
  • Create the script to pull the tools list from ldap and create the namespaces
  • Set up a toolforge job that runs that script
  • Add the entry to the toolhub list https://toolhub.wikimedia.org/lists/192

[1] https://gerrit.wikimedia.org/r/plugins/gitiles/labs/tools/maintain-kubeusers/

Related Objects

StatusSubtypeAssignedTask
ResolvedLucasWerkmeister
Resolvedmatmarex
ResolvedLegoktm
ResolvedLegoktm
Opendcaro
Resolveddcaro
ResolvedRaymond_Ndibe
Resolveddcaro
Resolveddcaro
Resolveddcaro
Resolveddcaro
ResolvedRaymond_Ndibe
ResolvedRaymond_Ndibe
Resolveddcaro
ResolvedRaymond_Ndibe
ResolvedRaymond_Ndibe
Resolvedfnegri
Resolvedfnegri
ResolvedRaymond_Ndibe
ResolvedNone
Resolveddcaro
Resolveddcaro
ResolvedAndrew
ResolvedSlst2020
Resolveddcaro
ResolvedRaymond_Ndibe
ResolvedRaymond_Ndibe
ResolvedRaymond_Ndibe
Resolveddcaro
Resolveddcaro
Resolveddcaro

Event Timeline

dcaro removed dcaro as the assignee of this task.Oct 19 2021, 1:45 PM
dcaro removed a project: User-dcaro.
dcaro renamed this task from [webservice] Update maintain-kubeusers (or similar) to create the tools namespaces in harbor to [tbs][poc]Find a way to create and maintain the harbor namespaces.Dec 6 2021, 10:49 AM
dcaro updated the task description. (Show Details)
dcaro moved this task from To refine to Refined on the User-dcaro board.
dcaro renamed this task from [tbs][poc]Find a way to create and maintain the harbor namespaces to [tbs.maintainkubeusers]Create harbor namespaces using maintainkubeusers script.Aug 26 2022, 8:16 AM
dcaro removed a subscriber: Bstorm.
dcaro updated the task description. (Show Details)
Raymond_Ndibe renamed this task from [tbs.maintainkubeusers]Create harbor namespaces using maintainkubeusers script to Create harbor namespaces using any method agreed by the team.Nov 22 2022, 2:37 PM
Raymond_Ndibe updated the task description. (Show Details)

just for documentation sake incase we forget, the custom cronjob approach is currently the preferred approach, but that might change later

dcaro renamed this task from Create harbor namespaces using any method agreed by the team to [tbs.maintainkubeusers] Pre-create harbor namespaces.Nov 22 2022, 2:42 PM
dcaro updated the task description. (Show Details)
dcaro updated the task description. (Show Details)
dcaro updated the task description. (Show Details)
dcaro changed the task status from Open to In Progress.Dec 1 2022, 9:59 AM
dcaro moved this task from Refined to Doing on the User-dcaro board.
dcaro removed dcaro as the assignee of this task.Dec 8 2022, 9:30 AM
dcaro moved this task from In Progress to Next Up on the Toolforge Build Service (Iteration 06) board.
dcaro changed the task status from In Progress to Open.Dec 8 2022, 9:36 AM
dcaro renamed this task from [tbs.maintainkubeusers] Pre-create harbor namespaces to [tbs.harbor] Pre-create harbor namespaces.Dec 15 2022, 1:16 PM
dcaro renamed this task from [tbs.harbor] Pre-create harbor namespaces to [tbs.harbor] Pre-create namespaces.

I would like to know more details about why maintain_harbor is planned to run as a Toolforge jobs framework cronjob rather than a standalone application (or cronjob) in the kubernetes cluster.

I'm mentioning this because I feel that tying the two things together can make it cumbersome to operate (both things) in the future, for little added value.

The change to run as a standalone cronjob deployment in k8s would be very small.

I would like to know more details about why maintain_harbor is planned to run as a Toolforge jobs framework cronjob rather than a standalone application (or cronjob) in the kubernetes cluster.

I'm mentioning this because I feel that tying the two things together can make it cumbersome to operate (both things) in the future, for little added value.

The change to run as a standalone cronjob deployment in k8s would be very small.

We talked about this, and the main concerns are:

  • development time: writing the deployment helm chart would take time, instead of using the ready-made cron abstraction by jobs-api
  • secret management: maintain-harbor requires a secret to be able to interact with the harbor API. The only way we know of doing that today in Cloud VPS is using a puppet secret: deploying a secret to k8s-control filesystem and read it at deploy.sh runtime. Again, having this setup in place would require time. Even if this secret mechanism can be reused by other Toolforge components, is not a priority right now.