-
Notifications
You must be signed in to change notification settings - Fork 122
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
feat: controller-wide pipeline templates. Closes #305 #314
Conversation
Signed-off-by: David Seapy <[email protected]>
|
||
type VertexTemplate struct { | ||
// +optional | ||
AbstractPodTemplate `json:",inline" protobuf:"bytes,1,opt,name=abstractPodTemplate"` |
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.
initially did inline to be consistent with daemon
/job
, but just looked back at issue and seems like maybe json:"podTemplate,omitempty"
is desired to be consistent with containerTemplate
/initContainerTemplate
. let me know if i should make that change here & the docs.
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.
podTemplate
is better.
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.
just to confirm, i should leave daemon
and job
unchanged (keep those inline)?
@@ -76,11 +77,16 @@ func (r *pipelineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c | |||
log := r.logger.With("namespace", pl.Namespace).With("pipeline", pl.Name) | |||
plCopy := pl.DeepCopy() | |||
ctx = logging.WithLogger(ctx, log) | |||
if err := plCopy.Spec.Templates.UpdateWithDefaultsFrom(r.templates); err != nil { |
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.
nil check for plCopy.Spec.Templates
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.
currently there is a check in the func & unit tests for it being nil, which is not typical but done to reduce code on the caller side.
if tpl == nil {
*tpl = *defaultTemplate.DeepCopy()
return nil
}
should i move that bit out to the couple places the func is called?
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.
Can also change func that takes 2 templates that doesn't modify either, but returns a separate one, and do nil checks on the caller side?
|
||
type VertexTemplate struct { | ||
// +optional | ||
AbstractPodTemplate `json:",inline" protobuf:"bytes,1,opt,name=abstractPodTemplate"` |
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.
podTemplate
is better.
|
||
result, reconcileErr := r.reconcile(ctx, plCopy) | ||
if reconcileErr != nil { | ||
log.Errorw("Reconcile error", zap.Error(reconcileErr)) | ||
} | ||
plCopy.Spec.Templates = pl.Spec.Templates.DeepCopy() |
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.
Is it because plCopy.Spec.Templates
gets changed in reconcile()
? This would be confusing and tricky if that was the case. I would prefer nothing to get changed under .Spec
.
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.
templates do not get changed in reconcile()
, but they do get changed from pl
immediately after plCopy is created in Reconcile().
Mostly I was trying to find a good way to do the cluster-wide + pipeline-wide templates merge once & not need to pass down the merged templates through the func calls. However maybe each job
, daemon
, vertex
component can handle their own merge to avoid changing it... will look at that.
docs/pipeline-customization.md
Outdated
|
||
## Vertex customization | ||
|
||
See `Component customization` described above. |
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.
Is there an place to mention that it can also be done in pipeline level?
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'm a bit confused, as this is for the pipeline level, do you mean modify this to mention it's for the pipeline-level? At the top of the page in the Pipeline Customization
section I try to describe things can be done in the controller configmap and vertexes can be customized individually, but may not be doing a great job with the wording.
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.
With this change, there are 3 places to customize the vertex template - configmap, pipeline spec.template.vertex
, and pipeline.spec.vertices[*].xxx
, I don't see the 2nd one is mentioned.
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.
The "component customization" section in this file and the comment in the example attempt to describe that.
dfv1 "github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1" | ||
) | ||
|
||
func LoadPipelineTemplates() (*dfv1.Templates, error) { |
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.
Use the same way as LoadConfig
to achieve hot reloading?
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.
sure, i was struggling to get viper to unmarshal the yaml the way it does for config but I can still use viper to watch it but not unmarshal. or if we need viper to unmarshal, I can look at why viper was unmarshaling it to empty Templates.
i'm slightly concerned with thread-safety. does it make sense to add read/write locking?
Signed-off-by: David Seapy <[email protected]>
I'm happy to do whatever is desired, for my current use-case setting on controller and vertex is sufficient. That said, I'm not sure how to leverage that for simpler code. At the moment, there is code for:
For daemon & job we already need to do (1) and (3), and regardless of pipeline-level vertex customization support I think we need to do (2). Maybe it's simpler because if changing approach to merging |
Ignore what I said, let's follow what we discussed before :), having 3 controls is valuable. |
+1, we have some internal use cases where we will be sharing the controller and running multiple ML pipelines. |
closing for now, ref: #331 (comment) tldr: as-written this doesn't resolve need for pipeline/vertex specific info (i.e. affinity/pdb label matching). |
Signed-off-by: David Seapy [email protected]
Closes #305.
Adds support for specifying controller-wide pipeline templates in the controller configmap.