-
Notifications
You must be signed in to change notification settings - Fork 716
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
[feature] Seperate the CRD and controller #281
Comments
i think a sperate crd yaml file should be the common pattern among k8s related project, e.g. istio. |
@caogj I think there are two patterns for this kind of project: operator and controller. In the operator pattern, the crd is usually created when the operator is initialized, e.g. etcd-operator. And in the controller pattern, the crd is usually placed in a sperate yaml file, e.g. kube-metacontroller and istio. Personally, I prefer the latter since CRD and the operator/controller are decoupled by design. |
I vote for separating the CRD and controller. Aside from this being common, CRD's are cluster scoped and not namespace scoped. But controllers can be name space scoped. We could potentially have multiple controllers running. |
@jlewi Could you explain more about why CRD is cluster scoped 🤔 /cc @DjangoPeng @ScorpioCPH (We have a discussion about it internally, too) |
Agree with @jlewi . TFJob CRD itself should be cluster scope rather than namespace scope, but the CRD object may belong to a specific namespace. The CRD guide also gives some explanations as below:
I'm not sure whether the default value of @gaocegege In our early internal discussion, we lay the problem aside. Now, it's the time to continues discussing it, although I think it's obvious that cluster scope is better. I remember that @ScorpioCPH also votes for cluster scope. Ref: https://github.com/caicloud/kubeflow-clientset/issues/18 |
BTW: We may need to set a dedicated Finalizer for TFJob CRD to handle some misoperations. |
@DjangoPeng Why do you want the CRD to be cluster scoped? If we scope it to cluster then all TfJobs are cluster scope which I don't think we want. We want it to be namespace scoped so that TfJobs are created in a particular namespace. |
@jlewi I realised that there is a misunderstanding of
Actually, if we set CRD as cluster scope, all corresponding CRD objects are cluster scope. I set the scope as $ kubectl get ct --all-namespaces
NAMESPACE NAME AGE
my-new-cron-object 17m Assuming that we keep the scope as $ kubectl get ct --all-namespaces
NAMESPACE NAME AGE
default my-new-cron-object-0 27s
test my-new-cron-object-1 24s Now, I think scope field in CRD should be |
Yes. |
So which namespace should we put our
|
Since the CRD is cluster scope namespace doesn't actually matter. So I think we should just leave it blank. |
We come to an agreement 🎉 |
Now we create CRD when the controller is initialized, and the implementation may cause some issues: #173 . Then I think if we could write a
crd.yml
similar to https://github.com/caicloud/kubeflow-controller/blob/master/examples/crd/crd.yml, to create the CRD directly in Kubernetes.If we does it, then the operator's logic is clear: dealing with the lifecycle of TFJob.
The text was updated successfully, but these errors were encountered: