-
Notifications
You must be signed in to change notification settings - Fork 535
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
Conversation
[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 |
The operator discovering other operators. The meta has arrived |
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.
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" |
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.
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 { |
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.
this will bypass our clusteroperator reporting, won't it?
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.
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?
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.
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") |
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.
I would remove these info lines or change to debug
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.
I bumped the log level to 4, so we shouldn't see these unless -v=4
at minimum.
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). |
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.
This list needs to be kept in sync with the supported bundle types - i.e. configmap and secret support will merge soon.
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.
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" |
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 probably want to be more granular than this. i.e. OperatorV1
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.
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
?
1b5abae
to
c8744fb
Compare
Makefile
Outdated
# Install kubebuilder if not found | ||
KUBEBUILDER_DIR := /tmp/kubebuilder_2.3.1_$(OS)_$(ARCH)/bin | ||
kubebuilder: | ||
ifeq (, $(shell which kubebuilder)) |
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.
personally I manage kubebuilder with brew
. is it better ux to just log a message asking you to install it?
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.
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.
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 control the base image there - see base.Dockerfile
. It would be great to not download this every time and be dependent on the network
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.
sure, I can add it there.
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.
done
return | ||
} | ||
|
||
type OperatorFactory 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.
nit: naming here is getting a bit confusing for the callsites, right? operator := factory.NewOperator(operator)
?
} | ||
|
||
return &OperatorReconciler{ | ||
Client: cli, |
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.
nit: gofmt
[]Reporter{printer.NewlineReporter{}}) | ||
} | ||
|
||
var _ = BeforeSuite(func() { |
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.
does this conflict with the test runner that Ben worked on in (see: x.mk
)?
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.
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.
pkg/feature/feature.go
Outdated
} | ||
|
||
var featureGates = map[featuregate.Feature]featuregate.FeatureSpec{ | ||
// OperatorLifecycleManagerV2: {Default: false, PreRelease: featuregate.Alpha}, |
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.
mistake?
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func MetaTimeHookFunc() mapstructure.DecodeHookFunc { |
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.
I expected a small unit test for this
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.
added
/hold until API fix is tagged and module version is bumped. |
/retest |
1a60d47
to
fc3af27
Compare
/hold cancel |
/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.
/retest |
1 similar comment
/retest |
/test all |
@njhale: The following test failed, say
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. |
Superseded by #1453 |
Description of the change:
Add the operators.coreos.com/v2alpha1 API group and Operator resource with component selection.