Skip to content

Clarifying ACK Update logic (spec/status, delta, etc.) #846

@echen-98

Description

@echen-98

The intent of this issue is to outline some of the challenges faced in determining the latest state of a resource and when/how it should be updated. Many of these items have already been addressed and have working solutions, but others still require input from other service teams and support at an ACK framework level.

Summary/TL;DR: What still needs to be addressed?

  1. Should latest.Spec be populated from scratch in ReadOne/sdkFind?
  2. How do we make the latest observed state in latest.Spec visible to the user?
  3. When should a Spec difference actually be added to the delta?
    1. Nil difference in one direction/default fields: in progress in ability to deal with server side defaults/initializers #812
    2. Nil difference in the other direction (e.g. k8s secrets fields): Issue opened (Support for SecretKeyReference updates #700), no discussion has occurred
    3. No nil difference, server returns different value than requested: workaround possible, but no framework-level solution yet
    4. No nil difference, but diff present because fields are immutable: a solution has been merged in, but there are still remaining questions
    5. Handle "update-only" fields (support update code paths for opensearchservice #816), issue opened
  4. How do we only add meaningful Spec differences to the delta?
  5. Should an Update payload only include the resource identifier along with diffs present in the delta, as opposed to everything currently in desired.Spec?

Dependent issues can be created as needed to discuss each of these items. The rest of the sections in the description provide some common context:

Definitions (descriptive, not prescriptive)

Spec - the fields corresponding to inputs of the Create API for a resource
Status - a collection of server responses from Create, Read, and Modify calls, including fields both related and unrelated to Spec fields. Can also contain additional state-keeping fields (e.g. conditions)

desired.Spec: the user-provided configuration of the resource
desired.Status: essentially a copy of latest.Status (after patching occurs)

latest.Spec: ideally, the currently observed state of all Spec fields resulting from a ReadOne call. In practice, some fields get updated with the observed state and others are copied over from desired.Spec

latest.Status: the aggregation of information returned by the API response, combined with previously observed state (latest is copied from desired, then modified, then patched back into desired) + other state-keeping fields.

More info on k8s conventions here

Given that updates are triggered upon Spec differences, latest.Spec must reliably represent the latest observed state. How do we populate each Spec field with the latest observed state?

There are a number of possible cases:

  1. Field in API response has same name as Spec field: generated code populates this field directly. Example
  2. API response contains information to populate the corresponding Spec field, but it may require some processing: the SetOutput methods or the post_set_output hooks allow service teams to manually populate the relevant Spec field. Example
  3. Additional API calls are required to obtain the information to populate the Spec field: service teams can also use the SetOutput methods or post_set_output hooks to handle this. Example 1 , Example 2
  4. The latest observed state of the field cannot be retrieved in the API response. This is the case with k8s secrets-enabled fields. (e.g. ElastiCache Replication Group has AuthTokenEnabled but you obviously can't retrieve the value AuthToken from the server). The update behavior of such fields may require some ACK framework-level input or support. Example

This discussion raises the first question below:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/runtimeIssues or PRs as related to controller runtime, common reconciliation logic, etclifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions