- 
                Notifications
    
You must be signed in to change notification settings  - Fork 169
 
feat: Adding support for extraContainers and StatefuleSet deployment on v2.2.2 #89
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
base: main
Are you sure you want to change the base?
feat: Adding support for extraContainers and StatefuleSet deployment on v2.2.2 #89
Conversation
The purpose of these modifications is to add support for deploying the registry container as a StatefuleSet STS instead of a Deployment. This need several modifications on the templates, because the STS handles volume differently than the Deployment. A source of instpiration for this modification is the Grafana Helm Chart https://github.com/grafana/helm-charts/tree/main/charts/grafana. Adding support for extraContainers to be able to add sidecar containers to the registry container. Signed-off-by: Nicolas-Peiffer <[email protected]>
| 
           I tested this and it works well. When can this be merged?  | 
    
| 
           Would love to see this merged soon. Is there anything blocking the review or merge process?  | 
    
| 
           From my understanding, deploying a statefulset for docker registry with more than one replica and more than one PVC would cause docker registry to function improperly because there's no notion of leader / follower or replication between members. Because of this restriction, a single replica stateful and a single replica deployment with a PVC deployed separately functionally achieves the same results. The ability to deploy a multi-replica statefulset would be misleading, whereas you can increase the deployment replicas, provided you are using an external storage provider. @Nicolas-Peiffer @pracskai Would you be able to provide some additional context around the reason you need to deploy this as a statefulset?  | 
    
| 
           Our use case is to run the Docker registry in proxy (pull-through cache) mode to reduce traffic for image pulls. The goal is to run multiple replicas for high availability, but without relying on shared RWX storage, which can be operationally challenging or unavailable in some Kubernetes environments. By using a StatefulSet with separate PVCs (RWO) per replica, each registry instance maintains its own local cache. This setup is acceptable because: 
 So, while a multi-replica statefulset may not suit a write-heavy or push-mode registry, it works well for proxy caching, especially when consistency isn’t critical and storage availability is limited to RWO PVCs.  | 
    
          
 
 Hello 👋 , at the time in 2022 (and since this then, I moved to other projects), I had a small footprint kubernetes cluster use case (1 cluster of 2 nodes) with the need for redundancies (availability) for the services deployed in each k8s nodes. Therefore, I needed to be able to deploy the exact same services on each of the 2 nodes, including the OCI registry service. And I was populating both OCI registries with tools likes dregsy and skopeo. I made sure the content of OCI registries was the same thanks to dregsy and skopeo. 
 However in this 2 nodes situation for my use case, one could argue that it would be simpler to have 2 clusters of 1 node instead of having 1 cluster of 2 nodes. There are pros and cons: 
 I know we can configure  But this was not my use case. So why should I bother configuring an affinity policy if I can use a  I hope this helps 😸  | 
    
| 
           By the way: I added support for  I added a couple of explanation in the PR main first comment. Maybe I should have done 2 different PR since the   | 
    
| 
           @Nicolas-Peiffer @pracskai Thanks so much for the context, the pull-through cache and manual replication strategies are some use cases I hadn't considered. I would love to get this PR through. I need to spend some more time reviewing and I think I will have some feedback. @Nicolas-Peiffer I'm okay with keeping the extraContainers in this PR. If I have any suggestions or feedback, would you be able to make those changes? If I were to push any commits to this branch, I would no longer be able to approve this PR due to the repo rules. Again, thanks for the context and for such quick responses as well, it really helps get things moving.  | 
    
| 
           I can do the changes if this means changing 1 or 2 lines of Helm template. For   | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried simplifying the logic here, let me know what you think. One thing that still needs work is the garbage collection cronjob - if that's enabled and stateful set is enabled the cronjob doesn't mount the PVC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I had a look at your suggestions. Unfortunately, I was not able to test them, but it looks okay. I commented under each of your remark.
This cancels and replace a previous PR 87.
The purpose of these modifications is to add support for deploying the registry container as a
StatefuleSetSTS instead of aDeployment. This need several modifications on the templates, because the STS handles volume differently than theDeployment. A source of inspiration for this modification is the Grafana Helm Chart https://github.com/grafana/helm-charts/tree/main/charts/grafana.And also adding support for
extraContainersto be able to add sidecar containers to the registry container to support calling OCI syncing tools like dregsy or skopeo to populate the OCI registry.Signed-off-by: Nicolas-Peiffer [email protected]
Release Notes
StatefuleSetmanifest object with dedicated per-sts PVC. Compatible withpodAntiAffinity.extraContainersto support calling OCI syncing tools like dregsy or skopeo to populate the OCI registry.