Skip to content

Function pipeline output does not show image version tags #4410

@JamesMcDermott

Description

@JamesMcDermott

Expected behavior

Function pipeline output includes version tag of the running/passed/failed function image as specified in the Kptfile.

Actual behavior

When using the tag attribute (with or without a semantic version constraint) or when no version tag is included in either tag or image (defaulting to "latest"), function pipeline output does not include the version tag of the executed image.

Information

Results from the introduction of the tag attribute in #4383. This is a problem especially when using a semantic version constraint, as there is no way to tell from the output what actual image version was selected and run.

Take this example Kptfile from the attached sample.zip:

apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
  name: app
pipeline:
  mutators:
    - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace
      tag: "0.4.1 - 0.4.3"
      configMap:
        namespace: staging
    - image: ghcr.io/kptdev/krm-functions-catalog/set-labels
      tag: "~0.2"
      configMap:
        tier: backend

Running kpt fn render results in the following output - note the lack of versions in the [RUNNING] and [PASS] lines:

Package: "sample"
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace" in 1.5s
[Results]: [info]: all matching namespaces are already "staging". no value changed, [info]: all `depends-on` annotations are up-to-date. no `namespace` changed
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels" in 1.4s
[Results]: [info]: set 6 labels in total
Successfully executed 2 function(s) in 1 package(s).

We should include the selected version tag in the image names both before ([RUNNING] lines) and after running ([PASS] or [FAIL] lines). In the case of a semantic version constraint, where the version tag is not yet resolved when the [RUNNING] line is printed, the semantic version constraint from the tag attribute should be included in full to indicate the use of the constraint.

Ideally, this should cover the following cases:

  1. tag not set; exact version tag included in image
    • OK in existing behaviour; should be preserved
  2. tag not set; no version tag in image
    • kpt resolution defaults to "latest" but "latest" is not included in output
      • for completeness' sake, code change: append "latest" tag to [RUNNING], [PASS], or [FAIL] lines in this case
  3. tag set; no version tag in image
    • code change: append value of tag to image names in [RUNNING] lines
    • code change: append resolved version tag to image names in [PASS] or [FAIL] lines
  4. tag set; exact version tag in image
    • kpt behaviour has tag value override any version set in image
      • BUT the output will show the version from image, whereas the actual function image was the one from tag!
    • in this case, the value or resolved version from tag must replace the one from image for the output:
      • code change: in [RUNNING] lines, replace version tag in image names with value of tag
      • code change: in [PASS] or [FAIL] lines, replace version tag in image names with resolved version tag

Steps to reproduce the behavior

  1. Build kpt from source on main branch to obtain tag attribute and semantic version constraint functionality
  2. Download and unzip the attached sample kpt package, sample.zip
  3. cd sample
  4. kpt fn render, making sure to use the kpt binary built in step 1 (likely $GOPATH/bin/kpt)
  5. Observe confusing lack of function image version information in the kpt output

Metadata

Metadata

Labels

area/fn-runtimeKRM function runtimebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions