Skip to content

v0.2.3

Choose a tag to compare

Notable changes

  • Add resolvable configmap/secret refs. The new types

    • component.ConfigMapReference
    • component.ConfigMapKeyReference
    • component.SecretReference
    • component.SecretKeyReference

    may be used in component's spec in order to reference a config map or secret as a whole, or just a specific key in the config map or secret. The references will be automatically loaded by the framework during the post-read-hook phase, and the loaded content can be retrieved by the according Data() or Value() methods; if the referenced object (or key in it) is missing, an error will be thrown, causing the reconcilation to enter a retry loop. For the key reference types it is possible to omit the key if at least
    one fallback key is defined as a struct tag, such as

    SecretRef SecretKeyReference `json:"secretRef" fallbackKeys:"value,value.yaml,value.yml"`
  • Restructure/enhance interfaces

    • The methods GetDeploymentNamespace() and GetDeploymentName() are moved from Component to an own interface, called PlacementConfiguration; this simplifies implementation of Component in simple cases.
    • The ClientConfiguration, ImpersonationConfiguration interfaces are moved from package cluster to package component.
    • Two new interfaces are added which allow to tweak requeue and retry behavior: component.RequeueConfiguration and component.RetryConfiguration.
    • All the above interfaces (PlacementConfiguration, ClientConfiguration, ImpersonationConfiguration, RequeueConfiguration, RetryConfiguration) can alternatively be implemented on component Spec (rather than on the component type itself).
    • The creation of components which want to provide PlacementConfiguration, ClientConfiguration, ImpersonationConfiguration, RequeueConfiguration or RetryConfiguration is simplified; it is sufficient to just embed the respective struct types PlacementSpec, ClientSpec, ImpersonationSpec, RequeueSpec or RetrySpec into the component's spec.
  • Add retriable errors.
    There is a new error type (types.RetriableError) which can be used anywhere in the reconciler logic (in particular in hooks and generators) to wrap other occuring errors; optionally a retry delay can be set on that error object; such errors will then be caught late in the reconciler flow, immediately before returning to controller-runtime. Basically, no error (but nil) will be returned to controller-runtime, and a RequeueAfter with the desired delay will be set instead in the response. This bypasses the (sometimes unwanted) default backoff done by controller-runtime, and leads to a linear retry behavior. In addition, components (or their specs) can implement two new interfaces component.RequeueConfiguration and component.RetryConfiguration, in order to override the default requeue interval (10m) and the default retry interval, which applies to retriable errors which do not specify a delay (default is the value of the requeue interval).

  • Refactor/improve ownerid handling.
    The new possibility of reconciling in a different cluster makes it necessary to include a cluster id into the ownerid.
    The cluster id that will be used is the K8s metadata.uid of the kube-system namespace (which can be considered stable
    as the kube-system namespace cannot be deleted).
    To avoid hitting the 63 character limit valid for label values, the owner id value is now hashed; note that the cleartext
    value can still be seen in the analogous annotation. The old label format will still be recognized, in order to ensure
    backwards compatibility.

Fixes

  • The path handling in helm/kustomize generator was fixed resp. made more robust.
  • Some issues were fixed in file walker:
    • Methods Unwrap() and Cause() were added to the walkError type (to make it work with errors.As()).
    • The determination of struct fields was adjusted (to avoid double passes in case of embedded structs).