Skip to content
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

pkg/ansible: Adding ansible operator controller and events package #473

Merged

Conversation

shawn-hurley
Copy link
Member

No description provided.

@shawn-hurley shawn-hurley changed the title Adding ansible operator controller and events pacakge pkg/ansible: Adding ansible operator controller and events pacakge Sep 11, 2018
@jwmatthews jwmatthews changed the title pkg/ansible: Adding ansible operator controller and events pacakge pkg/ansible: Adding ansible operator controller and events package Sep 13, 2018
@shawn-hurley shawn-hurley force-pushed the feature/add-AO-controller branch 2 times, most recently from 13b7718 to 5230f92 Compare September 19, 2018 15:22
}
if statusEvent.Event == "" {
err := errors.New("did not receive playbook_on_stats event")
logrus.Error(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be redundant here if we are logging err on return. If not then this is good.

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 24, 2018
}

// NewReconcileLoop - loop for a GVK.
// The reconcilation loop is need because the resync period
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: loop is needed

}
}
if needsUpdate {
err = r.Client.Update(context.TODO(), u)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an issue to track this, and assigned it to me.
#540

@hasbro17
Copy link
Contributor

LGTM

@shawn-hurley shawn-hurley added the language/ansible Issue is related to an Ansible operator project label Sep 26, 2018
}
eventHandlers := append(options.EventHandlers, events.NewLoggingEventHandler(options.LoggingLevel))

h := &AnsibleOperatorReconciler{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h -> aor or r?

statusEvent := eventapi.StatusJobEvent{}
for event := range eventChan {
for _, eHandler := range r.EventHandlers {
go eHandler.Handle(u, event)
Copy link
Contributor

@fanminshi fanminshi Sep 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dp we want to track the go rountine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offline discussion: no need to track go routines for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ 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.

pkg/ansible/controller/controller.go Show resolved Hide resolved
pkg/ansible/controller/reconcile.go Show resolved Hide resolved
* Adding new source for reconcilation
@shawn-hurley shawn-hurley merged commit 2e23ca2 into operator-framework:master Sep 27, 2018
johnkim76 pushed a commit to dymurray/operator-sdk that referenced this pull request Oct 2, 2018
hasbro17 added a commit that referenced this pull request Oct 4, 2018
#566)

* pkg/ansible: Adding paramconv and kubeconfig to ansible operator. (#471)

* Adding runner package. (#472)

* pkg/ansible: Adding ansible operator controller and events package (#473)

* make ansible task log outputs more readable (#545)
shawn-hurley pushed a commit to shawn-hurley/operator-sdk that referenced this pull request Oct 12, 2018
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)
shawn-hurley pushed a commit that referenced this pull request Oct 16, 2018
#566)

* pkg/ansible: Adding paramconv and kubeconfig to ansible operator. (#471)

* Adding runner package. (#472)

* pkg/ansible: Adding ansible operator controller and events package (#473)

* make ansible task log outputs more readable (#545)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/ansible Issue is related to an Ansible operator project size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants