v0.2.3
Notable changes
-
Add resolvable configmap/secret refs. The new types
component.ConfigMapReferencecomponent.ConfigMapKeyReferencecomponent.SecretReferencecomponent.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()orValue()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 asSecretRef SecretKeyReference `json:"secretRef" fallbackKeys:"value,value.yaml,value.yml"`
-
Restructure/enhance interfaces
- The methods
GetDeploymentNamespace()andGetDeploymentName()are moved fromComponentto an own interface, calledPlacementConfiguration; this simplifies implementation of Component in simple cases. - The
ClientConfiguration,ImpersonationConfigurationinterfaces are moved from packageclusterto packagecomponent. - Two new interfaces are added which allow to tweak requeue and retry behavior:
component.RequeueConfigurationandcomponent.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,RequeueConfigurationorRetryConfigurationis simplified; it is sufficient to just embed the respective struct typesPlacementSpec,ClientSpec,ImpersonationSpec,RequeueSpecorRetrySpecinto the component's spec.
- The methods
-
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 (butnil) will be returned to controller-runtime, and aRequeueAfterwith 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 interfacescomponent.RequeueConfigurationandcomponent.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 K8smetadata.uidof thekube-systemnamespace (which can be considered stable
as thekube-systemnamespace 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()andCause()were added to thewalkErrortype (to make it work witherrors.As()). - The determination of struct fields was adjusted (to avoid double passes in case of embedded structs).
- Methods