pkg/ansible: Adding ansible operator runner package#472
Conversation
52387f8 to
f0605d2
Compare
| } | ||
| return nil | ||
| } | ||
| func (r *runner) makeParameters(u *unstructured.Unstructured) map[string]interface{} { |
There was a problem hiding this comment.
It might be helpful to have a comment here to explain what the output format for parameters is:
{ "meta": {
"name": "<cr-name>",
"namespace": "<cr-namespace>",
},
<CR.spec fields>,
"_<group>_<kind>": {
<Full CR contents>
},
}
At least that's what I think it ends up as in the input directory's env/extravars.
|
|
||
| func (r *runner) isFinalizerRun(u *unstructured.Unstructured) bool { | ||
| finalizersSet := r.Finalizer != nil && u.GetFinalizers() != nil | ||
| // The the resource is deleted and our finalizer is present, we need to run the finalizer |
|
LGTM after nits |
| if req.Method == http.MethodPost { | ||
| logrus.Info("injecting owner reference") | ||
| dump, _ := httputil.DumpRequest(req, false) | ||
| fmt.Println(string(dump)) |
There was a problem hiding this comment.
Is this supposed to be here? Seems like this should be a debug statement
| owner := metav1.OwnerReference{} | ||
| json.Unmarshal(authString, &owner) | ||
|
|
||
| logrus.Printf("%#+v", owner) |
There was a problem hiding this comment.
This also seems like a debug statement.
| http.Error(w, m, http.StatusInternalServerError) | ||
| return | ||
| } | ||
| logrus.Printf(string(newBody)) |
dymurray
left a comment
There was a problem hiding this comment.
Only had some small nits. Everything else looks sane to me.
ac18a89 to
249e4cb
Compare
| } | ||
|
|
||
| func (e *EventReceiver) handleEvents(w http.ResponseWriter, r *http.Request) { | ||
|
|
There was a problem hiding this comment.
no need to have extra line here.
| "code": "410", | ||
| }).Info("stopped and not accepting additional events for this job") | ||
| return | ||
| } else { |
There was a problem hiding this comment.
is else statement here necessary? since the previous if condition returns.
| return err | ||
| } | ||
|
|
||
| if i.PlaybookPath != "" { |
There was a problem hiding this comment.
if we change to
if i.PlaybookPath == "" {
return nil
}
...I think the code has less nested if statement which makes the code cleaner.
There was a problem hiding this comment.
It might be a little cleaner but
- the nested if's are for error checking not logic. I would suggest that this is not that big of a concern.
- I think it is more clear, do X if PlaybookPath is set, rather than, if PlaybookPath is unset return and always do X. The first is more accurate to what we want rather than the second.
Thoughts?
There was a problem hiding this comment.
fair enough. let's keep as it is.
c4976f3 to
26d7d6d
Compare
|
lgtm |
26d7d6d to
57bc0fd
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.