pkg/ansible: Adding ansible operator controller and events package#473
Conversation
13b7718 to
5230f92
Compare
| } | ||
| if statusEvent.Event == "" { | ||
| err := errors.New("did not receive playbook_on_stats event") | ||
| logrus.Error(err.Error()) |
There was a problem hiding this comment.
Might be redundant here if we are logging err on return. If not then this is good.
5230f92 to
7b7d97c
Compare
7b7d97c to
10834e5
Compare
| } | ||
|
|
||
| // NewReconcileLoop - loop for a GVK. | ||
| // The reconcilation loop is need because the resync period |
| } | ||
| } | ||
| if needsUpdate { | ||
| err = r.Client.Update(context.TODO(), u) |
There was a problem hiding this comment.
Don't need to change this now but it might be worth looking into the Status client to see if there's a benefit to using that if we're just updating the status:
https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/unstructured_client.go#L136-L151
The default manager client comes with a status writer:
https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/split.go#L32
There was a problem hiding this comment.
Added an issue to track this, and assigned it to me.
#540
|
LGTM |
10834e5 to
50fc0fa
Compare
| } | ||
| eventHandlers := append(options.EventHandlers, events.NewLoggingEventHandler(options.LoggingLevel)) | ||
|
|
||
| h := &AnsibleOperatorReconciler{ |
| statusEvent := eventapi.StatusJobEvent{} | ||
| for event := range eventChan { | ||
| for _, eHandler := range r.EventHandlers { | ||
| go eHandler.Handle(u, event) |
There was a problem hiding this comment.
dp we want to track the go rountine?
There was a problem hiding this comment.
offline discussion: no need to track go routines for now.
There was a problem hiding this comment.
^ more info
the current idea with the handlers is to take actions(logs specifically) without waiting for them to finish. These actions are not supposed to be doing work in the cluster for now and therefore can't break anything. I don't see a reason to track them.
* Adding new source for reconcilation
50fc0fa to
8561e9f
Compare
operator-framework#566) * pkg/ansible: Adding paramconv and kubeconfig to ansible operator. (operator-framework#471) * Adding runner package. (operator-framework#472) * pkg/ansible: Adding ansible operator controller and events package (operator-framework#473) * make ansible task log outputs more readable (operator-framework#545)
No description provided.