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

Create registry pods for ConfigMap CatalogSources #556

Merged

Conversation

ecordell
Copy link
Member

@ecordell ecordell commented Nov 8, 2018

This is step 2 in a long line of changes to switch to using operator-registry in OLM.

  • Add pod reconciler that creates registry pods from configmaps
  • Add ConfigMap sourcetype as an alias for internal
  • Write tests

Note that this doesn't yet use the pods for resolving dependencies, so the in memory registry is staying for now.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2018
@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 8, 2018
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 8, 2018
@ecordell ecordell force-pushed the registry-pods branch 2 times, most recently from e2aa9e5 to 6bebbf1 Compare November 8, 2018 18:03
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 8, 2018
@ecordell ecordell changed the title [WIP] Create registry pods for configmaps Create registry pods for configmaps Nov 8, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2018
@ecordell ecordell changed the title Create registry pods for configmaps Create registry pods for ConfigMap CatalogSources Nov 8, 2018
@ecordell ecordell force-pushed the registry-pods branch 3 times, most recently from 9940b92 to 68132c8 Compare November 12, 2018 13:45
Copy link
Member

@alecmerdler alecmerdler left a 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"
Copy link
Member

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 {
Copy link
Member

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?

Copy link
Member Author

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 {
Copy link
Member

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?

Copy link
Member Author

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) {
Copy link
Member

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) {
Copy link
Member

Choose a reason for hiding this comment

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

nice catch

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2018
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 7, 2018
if err := c.ensureRoleBinding(source, overwrite); err != nil {
return err
}
if err := c.ensurePod(source, overwritePod); err != nil {
Copy link
Member

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

@ecordell ecordell force-pushed the registry-pods branch 2 times, most recently from 056e33e to de4f82f Compare December 12, 2018 19:49
@ecordell
Copy link
Member Author

/test e2e-aws-olm

@@ -19,6 +19,7 @@ import (
const (
defaultWakeupInterval = 15 * time.Minute
defaultCatalogNamespace = "tectonic-system"
Copy link
Member

Choose a reason for hiding this comment

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

tectonic-system?

@ecordell
Copy link
Member Author

/retest

6 similar comments
@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/retest

@ecordell ecordell force-pushed the registry-pods branch 3 times, most recently from 7132821 to 69cbdfe Compare December 18, 2018 01:03
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2018
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2018
@ecordell
Copy link
Member Author

/retest

@ecordell
Copy link
Member Author

/test e2e-aws-olm

Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2018
@njhale
Copy link
Member

njhale commented Dec 18, 2018

/approve

@openshift-ci-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 18, 2018
@openshift-merge-robot openshift-merge-robot merged commit 0c9e050 into operator-framework:master Dec 18, 2018
@ecordell ecordell deleted the registry-pods branch December 18, 2018 18:29
ecordell pushed a commit to ecordell/operator-lifecycle-manager that referenced this pull request Mar 8, 2019
Create registry pods for ConfigMap CatalogSources
@njhale njhale added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants