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

Upgrade pkg/runtime and controllers to controller-runtime v0.7.0 #613

Closed
7 tasks done
hiddeco opened this issue Dec 16, 2020 · 0 comments
Closed
7 tasks done

Upgrade pkg/runtime and controllers to controller-runtime v0.7.0 #613

hiddeco opened this issue Dec 16, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@hiddeco
Copy link
Member

hiddeco commented Dec 16, 2020

controller-runtime v0.7.0 was released last Friday, and we have been eagerly waiting for some of the newly introduced features like the context with logger, and a bug fix for the issue described in fluxcd/kustomize-controller#214.

Changes that will likely affect us

Breaking changes

A number of methods that previously took runtime.Object & internally type-asserted them to metav1.Object now take client.Object (for non-list objects) or client.ObjectList (for lists).

See release notes for details, as this includes changes to the events used in e.g. predicates.

High impact

Add a context w/ logger to Reconciler interface
Impact: add a context.Context parameter to your controller's
Reconcile() method signature, which you can use throughout your
Reconcile() function.

We propagate the context and a logger in all controllers at the moment, this can now simply be changed to just the context.

Change leaderlock from ConfigMap to ConfigMapsLeasesResourceLock
Impact: New RBAC permissions are needed by default for leaderelection (for
the coordination/v1 API). The new lock will automatically deal with
existing configmap locks (e.g. during upgrades). The can be set to its
previous value ("configmaps") in manager.Options.

leader-election-role manifests require an update.

Other notable changes

Simplify usage of EnqueueRequestsFromMapFunc

This means that things like

		Watches(
			&source.Kind{Type: &sourcev1.HelmChart{}},
			&handler.EnqueueRequestsFromMapFunc{ToRequests: handler.ToRequestsFunc(r.requestsForHelmChartChange)},
			builder.WithPredicates(SourceRevisionChangePredicate{}),
		)

can now be changed to

		Watches(
			&source.Kind{Type: &sourcev1.HelmChart{}},
			handler.EnqueueRequestsFromMapFunc(r.requestsForHelmChartChange),
			builder.WithPredicates(SourceRevisionChangePredicate{}),
		)
  • Zap: Add JSONEncoder and ConsoleEncoder opts
  • Added Encoder Config Options field.

Means our logic in runtime/logger can likely be simplified and re-use logic from the sigs.k8s.io/controller-runtime/pkg/log/zap package.

Remove logs from internal controller
Impact: automatic logs for "succesful reconcile" no longer exist (it tended to duplicate manual logs that folks had in place).

Nothing to do here, but 🎉 💯

ComponentConfig Implementation
Impact: a Manager can be configured by a ControllerManagerConfiguration or a custom defined configuration file. [...]

Nothing to do here, but worth investigating to provide configuration alternatives.

To-do

  • pkg/runtime
  • source-controller
  • kustomize-controller
  • helm-controller
  • notification-controller
  • image-reflection-controller
  • image-automation-controller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant