Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include chart annotations as event metadata #514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Aug 10, 2022

  1. Include chart annotations as event metadata

    Extend the registered event after the Helm reconciliation to include
    the chart annotations (if any) in the existing metadata field of the
    event body. `event` function defines now a new
     `metadata *chart.Metadata` parameter with this metadata.
    
    The fields defined in the chart annotations are merged to the already
    defined `meta` map in the `event` function, along with the already
    existing `revision` field. These fields are merged at the root level;
    so the `meta` map will have n + 1 fields, where n is the number of
    annotations the chart has defined.
    
    With the current notifications, is hard to be aware of what exactly was
    deployed, as just the Helm chart revision is included in the payload.
    If I wanted to know what specific change (or changeset) has been rolled
    out, it wouldn't be possible with the current setup. A workaround could
    be to abuse the chart `version` semver, but of course with several
    drawbacks, like needing to keep a 1-1 relationship between the char and
    app versions, having to come up with some specific encoding, having it
    to decode on the other end if a generic webhook receiver has been
    configured, and just probably being a bad practice.
    
    It's probably reasonable to be able to plug some arbitrary data into
    the event delivered by Flux, specially considering that the Helm charts
    already provide annotations for this.
    
    By including the chart annotations as part of the metadata, users can
    enrich their notifications as they wish by including the data they
    consider necessary for their own use cases.
    
    Doing it with the chart annotations, the user experience doesn't
    change, as the chart needs to be updated for making a release
    anyways, and the data can be set at that point; or just left it
    empty otherwise if it's not needed.
    
    The annotations must be in string:string format according to the Helm
    specification itself, so no complex nested structures are allowed.
    Prior to these changes, if nested annotations are specified in the
    chart, the Helm upgrade already fails with no registered event, so
    there's no check done regarding this matter.
    
    Signed-off-by: Julen Pardo <[email protected]>
    eljulians committed Aug 10, 2022
    Configuration menu
    Copy the full SHA
    aec55b2 View commit details
    Browse the repository at this point in the history