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

Enable Operator Discovery #1431

Closed
wants to merge 11 commits into from
Closed

Conversation

njhale
Copy link
Member

@njhale njhale commented Apr 7, 2020

Description of the change:

Add the operators.coreos.com/v2alpha1 API group and Operator resource with component selection.

@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 Apr 7, 2020
@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 Apr 7, 2020
@exdx
Copy link
Member

exdx commented Apr 7, 2020

The operator discovering other operators. The meta has arrived

Copy link
Member

@ecordell ecordell left a comment

Choose a reason for hiding this comment

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

Looking good!

@@ -14,12 +14,13 @@ import (
configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer"
"github.com/prometheus/client_golang/prometheus/promhttp"
Copy link
Member

Choose a reason for hiding this comment

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

nit: import order

@@ -227,5 +234,10 @@ func main() {
go monitor.Run(op.Done())
}

// Start the controller manager
if err := mgr.Start(ctx.Done()); 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.

this will bypass our clusteroperator reporting, won't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

What part in particular? No reporting that currently exists has been removed, is there anything of the Operator API/controller we want/need to add to reporting at this point?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sorry - I just meant that the healthiness of this control loop does not affect the clusteroperator's health. That is not necessarily something we need to figure out right now

}

// Setup a new controller to reconcile Operators
setupLog.Info("configuring controller")
Copy link
Member

Choose a reason for hiding this comment

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

I would remove these info lines or change to debug

Copy link
Member Author

Choose a reason for hiding this comment

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

I bumped the log level to 4, so we shouldn't see these unless -v=4 at minimum.

deploy/chart/crds/0000_50_olm_00-installplans.yaml Outdated Show resolved Hide resolved
deploy/chart/crds/0000_50_olm_00-subscriptions.yaml Outdated Show resolved Hide resolved
Watches(&source.Kind{Type: &apiregistrationv1.APIService{}}, enqueueOperator).
Watches(&source.Kind{Type: &operatorsv1alpha1.Subscription{}}, enqueueOperator).
Watches(&source.Kind{Type: &operatorsv1alpha1.InstallPlan{}}, enqueueOperator).
Watches(&source.Kind{Type: &operatorsv1alpha1.ClusterServiceVersion{}}, enqueueOperator).
Copy link
Member

Choose a reason for hiding this comment

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

This list needs to be kept in sync with the supported bundle types - i.e. configmap and secret support will merge soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

true -- not sure how we want to handle it. This is a stopgap for generic "watch all" behavior.

// OperatorLifecycleManagerV2 enables OLM's v2 APIs.
// owner: @njhale
// alpha: v0.15.0
OperatorLifecycleManagerV2 featuregate.Feature = "OperatorLifecycleManagerV2"
Copy link
Member

Choose a reason for hiding this comment

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

We probably want to be more granular than this. i.e. OperatorV1

Copy link
Member Author

@njhale njhale Apr 14, 2020

Choose a reason for hiding this comment

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

My thinking here is that we're probably going to enable all of the v2 APIs at once when we jump to v2. Do you see a situation where we want to enable APIs independently? e.g. InstallV2 w/o OperatorV2?

@njhale njhale force-pushed the op-disc branch 10 times, most recently from 1b5abae to c8744fb Compare April 13, 2020 22:41
@njhale njhale changed the title WIP: Enable Operator Discovery Enable Operator Discovery Apr 13, 2020
@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 Apr 13, 2020
Dockerfile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated
# Install kubebuilder if not found
KUBEBUILDER_DIR := /tmp/kubebuilder_2.3.1_$(OS)_$(ARCH)/bin
kubebuilder:
ifeq (, $(shell which kubebuilder))
Copy link
Member

Choose a reason for hiding this comment

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

personally I manage kubebuilder with brew. is it better ux to just log a message asking you to install it?

Copy link
Member Author

Choose a reason for hiding this comment

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

probably, but we want this to run automatically and it's not clear to me that openshift-ci runs unit tests in an image that we can control the build of (the src image). If we do, then I'm all for that route instead.

Copy link
Member

Choose a reason for hiding this comment

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

We control the base image there - see base.Dockerfile. It would be great to not download this every time and be dependent on the network

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, I can add it there.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Makefile Show resolved Hide resolved
return
}

type OperatorFactory interface {
Copy link
Member

Choose a reason for hiding this comment

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

nit: naming here is getting a bit confusing for the callsites, right? operator := factory.NewOperator(operator)?

}

return &OperatorReconciler{
Client: cli,
Copy link
Member

Choose a reason for hiding this comment

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

nit: gofmt

[]Reporter{printer.NewlineReporter{}})
}

var _ = BeforeSuite(func() {
Copy link
Member

Choose a reason for hiding this comment

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

does this conflict with the test runner that Ben worked on in (see: x.mk)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. This is scoped to the suite defined in this package, not to mention that the test sets options for the e2e tests and not unit tests.

}

var featureGates = map[featuregate.Feature]featuregate.FeatureSpec{
// OperatorLifecycleManagerV2: {Default: false, PreRelease: featuregate.Alpha},
Copy link
Member

Choose a reason for hiding this comment

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

mistake?

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func MetaTimeHookFunc() mapstructure.DecodeHookFunc {
Copy link
Member

Choose a reason for hiding this comment

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

I expected a small unit test for this

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

@njhale
Copy link
Member Author

njhale commented Apr 15, 2020

/hold

until API fix is tagged and module version is bumped.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2020
@njhale
Copy link
Member Author

njhale commented Apr 15, 2020

/retest

@njhale
Copy link
Member Author

njhale commented Apr 15, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2020
@njhale
Copy link
Member Author

njhale commented Apr 16, 2020

/retest

Add support for reconciling the v2alpha1 Operator API:
- generate Operator resources when none exist and labeled components
  found
- aggregate component references in the status of their respective
  Operators
- aggregate component status conditions to their respective Operators
- enabled by specifying the "OperatorLifecycleManagerV2" feature gate option
  when invoking the olm command

Also:
- bump go version to 1.13 to satisfy controller-runtime
- swap some API types imports to the operator-framework/api module
- regenerate clients and fakes
- Add an e2e test for the v2alpha1 Operator resource
- Add some e2e utilities for watching resource changes
- Make kubebuilder assets configurable using the KUBEBUILDER_ASSETS
  environment variable
- Remove automatic kubebuilder installation
- Throw make error if any kubebuilder assets are missing
- Add ConfigMaps to the set of resource types that can be Operator
  components (tracked by the controller)
- Remove extra comment
- Remove unused dynamic source implementation
For some reason the top-level update call was allowing updates to
Operator CR status subresources when its CRD was submitted as
v1beta1. Status updates broke as soon as we updated to v1 CRDs and the
status specific update became required.
Stop Operator unit test controller manager before stopping testenv to
prevent moot error message spam in test output.
Bump api module to v0.3.0 to get v1 CRDs with corrected schemas.
@njhale
Copy link
Member Author

njhale commented Apr 16, 2020

/retest

1 similar comment
@njhale
Copy link
Member Author

njhale commented Apr 16, 2020

/retest

@njhale
Copy link
Member Author

njhale commented Apr 16, 2020

/test all

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 16, 2020

@njhale: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-gcp-upgrade acd1067 link /test e2e-gcp-upgrade

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@ecordell ecordell mentioned this pull request Apr 16, 2020
5 tasks
@njhale
Copy link
Member Author

njhale commented Apr 17, 2020

Superseded by #1453

@njhale njhale closed this Apr 17, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants