Code Monkey home page Code Monkey logo

Comments (3)

phlogistonjohn avatar phlogistonjohn commented on June 12, 2024

Hi! First off, thanks a lot for this feedback it helps a lot.

Looking at the code, the operator creates the resources (PVC, Deployment, Service) in the operator's namespace and then sets the SMBShare resource as the owner of these resources (to have K8S garbage collect them).

To be honest, this code has gone back and forth a bit and is quite immature. I am not really shocked to find we're not handling this right.

But, K8S does not allow cross namespace ownership. So, if the SMBShare is created in a different namespace, this operation will fail. Please note that the return value is not checked:

controllerutil.SetControllerReference(s, pvc, m.scheme)

This is very helpful thanks - it reveals two problems: one is what you point out and the other is that our static checker is not detecting ignored errors!

In the demo showed in SambaXP right after provisioning the operator the context is set to use the namespace of the operator. As a result, all the resources created in the demo are created in that namespace and this issue does not occur.

Is the intention to force the users to create SMBShares only in the operator's namespace?

If you want to try out the samba share's operation it is true that creating the resources in the same namespace as the operator itself is your best bet today. In most of our integration tests this is what's done and it generally works.

What we ultimately want to do is a bit "squishy" as we're still trying to learn how best to deploy the various samba components in k8s and I'm not sure what workflows we want to support. That's where feedback like yours is valuable. If you were deploying this operator in your cluster, how would you like it to work in the ideal case?

I was trying to "clean up" the namespace behavior a few months ago and I probably made things worse. :-) So thank you for pointing this out.

from samba-operator.

ygalblum avatar ygalblum commented on June 12, 2024

I think an admin would like to provision the operator once and then allow the users provision shares. In addition, admins like to dedicate namespaces to different teams in order to separate between them. So, different teams create resources in their own namespace. This also allows the admin to monitor the usage of each team, in the form of their namespace(s).

So, I think you should make sure users can create shares in any namespace

from samba-operator.

phlogistonjohn avatar phlogistonjohn commented on June 12, 2024

I think an admin would like to provision the operator once and then allow the users provision shares. In addition, admins like to dedicate namespaces to different teams in order to separate between them. So, different teams create resources in their own namespace. This also allows the admin to monitor the usage of each team, in the form of their namespace(s).

So, I think you should make sure users can create shares in any namespace

Thanks. That certainly makes sense to me. I guess given the restrictions k8s places on secret access and ownership I guess that the operator must create resources in the same namespace as the SmbShare resource. It was (kind of) doing that before so I guess it shouldn't be too difficult to start doing that again in a cleaner manner.

from samba-operator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.