GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
15k stars 1.62k forks source link

Local builds are not used when overwriting values files #7369

Closed JoostDeCupere closed 2 years ago

JoostDeCupere commented 2 years ago

Expected behavior

artifactOverrides and valuesFiles can be used togheter. When a local build is done (in my case on kind) the image should be pushed in the cluster by skaffold and the cluster will use that pushed image without trying to fetch it from a docker repo

Actual behavior

When I use this without the valuesFiles overwrite the image is found by my Pod. When I do have the valuesFiles overwrite my pod will try to pull the image from a docker repository.

Information

The image seems to be loaded in the cluster correctly in both cases

Loading images into kind cluster nodes...
 - acs:89a51b77c871e11a847a8de213bc6ebc9c96c404f739ed8c2abccfc1d863b53e -> Loaded

And they are referenced correctly in the pod's image tag:

 containers:
  - envFrom:
    - configMapRef:
        name: acs-configmap
    - secretRef:
        name: acs-secret
    image: acs:89a51b77c871e11a847a8de213bc6ebc9c96c404f739ed8c2abccfc1d863b53e

The only difference I see in the 2 pods is that when using the skaffold file withouth the valuesFiles overwrite (and all works) the containerStatusses of the pod it looks like this

containerStatuses:
  - containerID: containerd://5f108f679b5449ee248e747d76cff3a43f85ecb6d915240eedf07cbd191fd20e
    image: docker.io/library/acs:89a51b77c871e11a847a8de213bc6ebc9c96c404f739ed8c2abccfc1d863b53e
    imageID: sha256:89a51b77c871e11a847a8de213bc6ebc9c96c404f739ed8c2abccfc1d863b53e

When the valuesFiles overwrite is specified the containerStatusses of the pod look like this (and it fails to pull the image)

 containerStatuses:
  - image: acs:89a51b77c871e11a847a8de213bc6ebc9c96c404f739ed8c2abccfc1d863b53e
    imageID: ""
apiVersion: skaffold/v2beta10
kind: Config
metadata:
  name: dauntless
build:
  local:
    concurrency: 0
  artifacts:
    - image: acs
      custom:
        buildCommand: ./buildAcsDockerImage.sh

deploy:
  helm:
    releases:
      - name: dauntless
        chartPath: helm
        artifactOverrides:
          acs.image.repository: acs
        valuesFiles:
          - local-values.yaml

Steps to reproduce the behavior

Reproduced with skaffold dev

Logs from `skaffold dev -vdebug: skaffold-logs.txt

tejal29 commented 2 years ago

Hey @JoostDeCupere We are changing how images are replaced for helm in v1.39.0 Please stay tuned.

tejal29 commented 2 years ago

This will be fixed by helm template and kubectl deploy now on v2.