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

Store digest of latest image in ImagePolicy status #368

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Commits on Sep 20, 2023

  1. Store digest of latest image in ImagePolicy's status

    The new API field `.status.latestDigest` in the `ImagePolicy` kind
    stores the digest of the image referred to by the the
    `.status.latestImage` field.
    
    The setting of this field is governed by the newly introduced field
    `.spec.digestReflectionPolicy` which takes one of the values `Always`
    or `IfNotPresent`. See the updated documentation under `docs/spec/`
    for details.
    
    The new status field can be used to pin an image to an immutable
    descriptor rather than to a potentially moving tag, increasing the
    security of workloads deployed on a cluster.
    
    The goal is to make use of the digest in IAC so that manifests can be
    updated with the actual image digest.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    727aff4 View commit details
    Browse the repository at this point in the history
  2. Introduce ImagePolicy.Status.LatestRef field

    This new field summarizes all data reflecting an image reference, i.e.
    the repository name, tag and digest.
    
    Since this change changes the API in a backwards-incompatible way, the
    new API version v1beta3 is introduced.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    ab8a91a View commit details
    Browse the repository at this point in the history
  3. Add "Never" as a valid value for .spec.digestReflectionPolicy

    This way we circumvent issues with server-side apply so that users can
    explicitly change this field instead of having to remove it. The
    latter case might lead to the API server not removing it if another
    field manager is registered for that field, causing an unintended
    drift.
    
    This commit also aligns the v1beta3 API with the latest changes done
    in v1beta2.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    111fe05 View commit details
    Browse the repository at this point in the history
  4. Revert introduction of v1beta3

    We agreed to make the changes in the existing v1beta2 API version.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    5f4903b View commit details
    Browse the repository at this point in the history
  5. Fix up print columns to reflect changes in ImagePolicy status

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    99b5126 View commit details
    Browse the repository at this point in the history
  6. Fix comment

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    c85404e View commit details
    Browse the repository at this point in the history
  7. Add missing license headers

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    7fa66fb View commit details
    Browse the repository at this point in the history
  8. Address remaining review comments

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    3cd160b View commit details
    Browse the repository at this point in the history
  9. Better error message

    .spec.image has no relevance in the given package, anymore.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    efefbd5 View commit details
    Browse the repository at this point in the history
  10. Fix test

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    6e3a989 View commit details
    Browse the repository at this point in the history
  11. Remove noop statements from test

    These must have been leftovers from previous iterations of this test.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    a3e050f View commit details
    Browse the repository at this point in the history
  12. Some small API changes to ImagePolicy

    1. Default digestReflectionPolicy to "Never" and add a getter. With
       the getter method we will never encounter an empty policy even if
       defaulting hasn't taken place.
    2. Make status.latestRef a pointer to align with
       status.observedPreviousRef. Having both fields be pointers makes it
       easier to use them in code so we only have to compare to nil and
       not the zero value.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    af0fa03 View commit details
    Browse the repository at this point in the history
  13. Add proper setting of .status.observedPreviousRef

    The field hasn't been set properly before. Correct behaviour is backed
    by associated unit tests.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    b787e9c View commit details
    Browse the repository at this point in the history
  14. Bring back updated spec docs

    The updated documentation has gotten lost due to the back and forth
    with v1beta3.
    
    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    5cfa766 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2023

  1. Address latest PR comments

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    6c9b87e View commit details
    Browse the repository at this point in the history
  2. Generate manifests

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    962576b View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2023

  1. Re-generate API docs

    Signed-off-by: Max Jonas Werner <[email protected]>
    Max Jonas Werner committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    13c2f70 View commit details
    Browse the repository at this point in the history