Enable Conditions subresources for Functions #591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want the ability to perform out-of-band operations against Function state changes, such as applying custom business logic, and track the progress of these operations in a durable way. One way to do this is for the out-of-band process to have its own CRD that references each Function and stores its state therein; however, this is rather heavy-handed just for tracking some purposes. So we instead introduce Conditions to the Function status, which is a common CRD practice for this use case.
This pull request includes several changes to the
api/v1
package and updates to the Kubernetes CustomResourceDefinition (CRD) for functions. The most important changes focus on enhancing the deepcopy functions and adding conditions to the function status.CRD subresources aren't prescriptive in how they're used, but let's come up with a use case to better understand the intent. Let's say I want to apply some custom business logic in reaction to Functions changing, something like syncing these functions to an alternate location. In this scenario, my non-owner / out-of-band process can react to Function state changes and perform its sync logic, once completed, the non-owner process would update the Function's conditions to reflect its own operations.
By way of an example, some user creates the following Function and Ingestor creates the Function in the appropriate Kusto cluster
In response, some other controller that has nothing to do with adx-mon, observes that there is a new Function and applies some business logic, then updates the Function to store reflect that it has already processed the Function
Enhancements to deepcopy functions:
api/v1/zz_generated.deepcopy.go
: ModifiedDeepCopyInto
methods forAlertRule
,AlertRuleSpec
, andFunction
to ensure deep copying of nested structures, including handling ofSpec
andConditions
fields. [1] [2] [3] [4] [5]Updates to function status:
api/v1/function_types.go
: AddedConditions
field to theFunctionStatus
struct to track the status conditions of the function.Kubernetes CRD updates:
kustomize/bases/functions_crd.yaml
: Updated the CRD version annotation and added a detailed schema for theConditions
field in the function status. [1] [2]Other changes:
api/v1/zz_generated.deepcopy.go
: Added import formetav1
package to support the newConditions
field.