-
Notifications
You must be signed in to change notification settings - Fork 544
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
Create registry pods for ConfigMap CatalogSources #556
Create registry pods for ConfigMap CatalogSources #556
Conversation
eba191a
to
08457e6
Compare
e2aa9e5
to
6bebbf1
Compare
6bebbf1
to
927888b
Compare
9940b92
to
68132c8
Compare
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 a few thoughts about code design, but I'm sure it works.
@@ -7,12 +7,17 @@ import ( | |||
"sync" | |||
"time" | |||
|
|||
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister" |
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.
Fix import order.
var timeNow = func() metav1.Time { return metav1.NewTime(time.Now().UTC()) } | ||
|
||
// catalogSourceDecorator wraps CatalogSource to add additional methods | ||
type catalogSourceDecorator struct { |
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.
Why not just use pure functions instead of embedding a struct?
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.
It's mostly a style issue; I personally think writing compositions of objects in go ends up more readable than writing pure functions.
That said, all of the methods I defined on the decorator require state from the CatalogSource. Wrapping it in a (private) struct is equivalent to defining a set of functions that all take the catalog source as a first argument.
The way I'm using the struct here is way more like you'd use a State Monad to thread common state throughout pure function calls.
return rb | ||
} | ||
|
||
type RegistryReconciler interface { |
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 we potentially not introduce another class that ends in -er?
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.
In general I think naming doesn't matter nearly as much as interface shapes, and names should just be whatever will help a reader the most. So if there's a name that would help you read it better, I would be happy to change it here 😁
return op, nil | ||
} | ||
|
||
func (o *Operator) syncObject(obj interface{}) (syncError 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.
👍
@@ -111,6 +111,6 @@ func (n *NullServiceNamespaceLister) Get(name string) (*v1.Service, error) { | |||
} | |||
|
|||
// GetPodServices returns nil and an error explaining that this is a NullServiceNamespaceLister. | |||
func (n *NullServiceAccountNamespaceLister) GetPodServices(pod *v1.Pod) ([]*v1.Service, error) { | |||
func (n *NullServiceNamespaceLister) GetPodServices(pod *v1.Pod) ([]*v1.Service, 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.
nice catch
68132c8
to
6014135
Compare
if err := c.ensureRoleBinding(source, overwrite); err != nil { | ||
return err | ||
} | ||
if err := c.ensurePod(source, overwritePod); 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.
We could make use of a Deployment instead of a Pod. Then we would get rolling updates and a safeguard against losing a working registry pod (if the CatalogSource's ConfigMap is no longer valid).
056e33e
to
de4f82f
Compare
/test e2e-aws-olm |
cmd/catalog/main.go
Outdated
@@ -19,6 +19,7 @@ import ( | |||
const ( | |||
defaultWakeupInterval = 15 * time.Minute | |||
defaultCatalogNamespace = "tectonic-system" |
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.
tectonic-system?
738d607
to
800120d
Compare
/retest |
6 similar comments
/retest |
/retest |
/retest |
/retest |
/retest |
/retest |
800120d
to
ee50f5e
Compare
/retest |
7132821
to
69cbdfe
Compare
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.
/lgtm
69cbdfe
to
1d71139
Compare
/retest |
/test e2e-aws-olm |
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.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njhale The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Create registry pods for ConfigMap CatalogSources
This is step 2 in a long line of changes to switch to using operator-registry in OLM.
Note that this doesn't yet use the pods for resolving dependencies, so the in memory registry is staying for now.