Skip to content

The set-image function sometimes omits the : between the image name and tag if newTag is not specified #4344

@mozesl-nokia

Description

@mozesl-nokia

Expected behavior

The old tag is correctly preserved.

Actual behavior

The : is missing from the final output, therefore it will act like "$newName$oldTag:latest"

Information

kpt version: 1.0.0-beta.58, 1.0.0-beta.59.1
set-image version: v0.1, v0.1.2
kpt package: https://github.com/nephio-project/porch/tree/f72334d66f381428e0ee89e40c46920cbb07de96/test/pkgs/gitea-dev

Steps to reproduce the behavior

I want to inject a registry mirror into the deployment.

function config:

apiVersion: fn.kpt.dev/v1alpha1
kind: SetImage
metadata:
  name: my-func-config
image:
  name: gitea/gitea
  newName: <some mirror of docker.io>/gitea/gitea
additionalImageFields:
  - kind: Deployment
    group: apps
    version: v1
    create: false
    path: spec/template/spec/containers[]/image
  - kind: Deployment
    group: apps
    version: v1
    create: false
    path: spec/template/spec/initContainers[]/image

command:

kpt fn eval \
    --image ghcr.io/kptdev/krm-functions-catalog/set-image:v0.1.2 \
    --fn-config "fn_config.yaml"

result:

The initContainer image fields are correct, but the single container's image field is bad:

registry1-docker-io.my.mirror.com/gitea/gitea1.23.8-rootless
                                            ^^ missing :

workaround:

Setting newTag in the function config redundantly properly adds the missing :.

Metadata

Metadata

Assignees

Labels

area/fn-catalogFunctions CatalogbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions