(Potentially) incompatible changes
-
The type
reconciler.ReconcilerOptions
is changed:- The boolean attribute
CreateMissingNamespaces
is replaced with a new attributeMissingNamespacesPolicy
that can have the valuesCreate
(default) orDoNotCreate
. The default behavior is backwards compatible; only people who explicitly have set the old attribute have to adopt the new notation in the obvious way. - Finalizer and field owner used by the reconciler can now explicitly be configured by setting the attributes
Finalizer
andFieldOwner
in the reconciler options. If unset it defaults to the reconciler name passed toreconciler.NewReconciler()
, which makes that change backwards compatible.
- The boolean attribute
-
The interface
component.PolicyConfiguration
was enhanced by an additional methodGetMissingNamespacesPolicy() reconciler.MissingNamespacesPolicy
. People who implemented that interface explicitly have to add this method to their implementation. Most people however probably just includecomponent.PolicySpec
into their component's spec type. They don't have to react, but should regenerate their CRD manifest, in order to expose the new fieldspec.missingNamespacesPolicy
which is now contained incomponent.PolicySpec
. -
The type
component.ReconcilerOptions
is changed in a way similar toreconciler.ReconcilerOptions
(that is, the attributeCreateMissingNamespaces
is replaced byMissingNamespacesPolicy
and new attributesFinalizer
andFieldOwner
are added). In addition, there is a new optionDefaultServiceAccount
which allows the name of a service account that can be used during the reconciliation of a component to impersonate the client used to reconcile the dependent objects, as long as the component does not explicitly specify an impersonation or kubeconfig (by implementing theImpersonationConfiguration
orClientConfiguration
interfaces); note that the specifiedDefaultServiceAccount
always refers to themetadata.namespace
or the component. -
When a component resource is reconciled, two Kubernetes API clients are constructed:
- The local client; it always points to the cluster where the component resides. If the component implements impersonation (that is, the component type or its spec implements the
ImpersonationConfiguration
interface), and an impersonation user or groups are specified by the component resource, then the specified user and groups are used to impersonate the controller's kubeconfig. Otherwise, if aDefaultServiceAccount
is defined in the reconciler's options, then that service account (relative to the componentsmetadata.namespace
) is used to impersonate the controller's kubeconfig. Otherwise, the controller's kubeconfig itself is used to build the local client. The local client is passed to generators via their context. For example, theHelmGenerator
andKustomizeGenerator
provided by component-operator-runtime use the local client to realize thelocalLookup
andmustLocalLookup
template functions. - The target client; if the component specifies a kubeconfig (by implementing the
ClientConfiguration
interface), then that kubeconfig is used to build the target client. Otherwise, a local client is used (possibly impersonated), created according the the logic described above. The target client is used to manage dependent objects, and is passed to generators via their context. For example, theHelmGenerator
andKustomizeGenerator
provided by component-operator-runtime use the target client to realize thelookup
andmustLookup
template functions.
This changes the previous impersonation logic a little bit. Other than before, no impersonation happens at all if a kubeconfig is specified (through
ClientConfiguration
). In addition, relative service accounts returned byGetImpersonationUser()
(that is: a user of the formsystem:serviceaccounts::name
, setting an empty namespace), now will be interpreted always relative to themetadata.namespace
of the component resource; previously, the namespace specified by aPlacementConfiguration
implementation was considered as well; this is no longer the case. - The local client; it always points to the cluster where the component resides. If the component implements impersonation (that is, the component type or its spec implements the
-
The
clnt
parameter of theHelmGenerator
andKustomizeGenerator
constructors is now ignored (and will be removed in a future release). Instead, these generators always use the local client, constructed as described above.