Expected behavior
I expect skaffold config --kube-context set default-repo to work.
Actual behavior
Configured default-repo for the kube context is ignored and the local-registry-hosting value from the cluster is used instead.
Information
- Skaffold version: 1.38.0
- Operating system: Ubuntu 22.04
- Installed via: skaffold.dev
- Contents of skaffold.yaml:
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: nginx
deploy:
kubectl:
manifests:
- deployment.yaml
Dockerfile:
deployment.yaml:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
Steps to reproduce the behavior
k3d cluster create --registry-create=test-registry.localhost -p 5000
skaffold config --kube-context=k3d-k3s-default set default-repo test-registry.localhost:5000
skaffold --kube-context=k3d-k3s-default run
- observe the use of the
localhost:xxxx repo name in the image tag rather than test-registry.localhost:5000
- this is the same as the
host field from: kubectl --context=k3d-k3s-default get cm -n kube-public local-registry-hosting -o yaml
I think the reason for this is that the default repo is only used from the command line options here. I think if this code block was duplicated for the default repo option, that might work.
% skaffold -vdebug --kube-context=k3d-k3s-default run
INFO[0000] Activated kube-context "k3d-k3s-default" subtask=-1 task=DevLoop
DEBU[0000] skaffold API not starting as it's not requested subtask=-1 task=DevLoop
INFO[0000] Skaffold &{Version:v1.38.0 ConfigVersion:skaffold/v2beta28 GitVersion: GitCommit:89b789ddcfe00d2fe7626fd86ef39a3eb6b455c5 BuildDate:2022-04-06T15:00:45Z GoVersion:go1.17.7 Compiler:gc Platform:linux/amd64 User:} subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/home/user/.skaffold/config" subtask=-1 task=DevLoop
DEBU[0000] found config for context "k3d-k3s-default" subtask=-1 task=DevLoop
DEBU[0000] parsed 1 configs from configuration file /workspaces/evs-at-risc/skaffold-default-repo-issue/skaffold.yaml subtask=-1 task=DevLoop
DEBU[0000] Defaulting build type to local build subtask=-1 task=DevLoop
INFO[0000] map entry found when executing locate for &{nginx . <nil> {0xc0002f9ad0 <nil> <nil> <nil> <nil> <nil> <nil>} [] {[] []} []} of type *v1.Artifact and pointer: 824645608384 subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: k3d-k3s-default subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `k3d-k3s-default` subtask=-1 task=DevLoop
INFO[0000] using default-repo=localhost:38163 from cluster configmap subtask=-1 task=DevLoop
DEBU[0000] Running command: [minikube version --output=json] subtask=-1 task=DevLoop
DEBU[0000] setting Docker user agent to skaffold-v1.38.0 subtask=-1 task=DevLoop
DEBU[0000] CLI platforms provided: "" subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `k3d-k3s-default` subtask=-1 task=DevLoop
DEBU[0000] platforms detected from active kubernetes cluster nodes: "linux/amd64" subtask=-1 task=DevLoop
DEBU[0000] platforms selected for artifact "nginx": "linux/amd64" subtask=-1 task=DevLoop
DEBU[0000] Using builder: local subtask=-1 task=DevLoop
DEBU[0000] push value not present in NewBuilder, defaulting to true because cluster.PushImages is true subtask=-1 task=DevLoop
INFO[0000] build concurrency first set to 1 parsed from *local.Builder[0] subtask=-1 task=DevLoop
INFO[0000] final build concurrency value is 1 subtask=-1 task=DevLoop
Generating tags...
- nginx -> DEBU[0000] Running command: [git describe --tags --always] subtask=-1 task=Build
DEBU[0000] Command output: [d84d0f4
] subtask=-1 task=Build
DEBU[0000] Running command: [git status . --porcelain] subtask=-1 task=Build
DEBU[0000] Command output: [?? skaffold-default-repo-issue/
] subtask=-1 task=Build
localhost:38163/nginx:d84d0f4-dirty
INFO[0000] Tags generated in 13.715181ms subtask=-1 task=Build
Checking cache...
^C
Expected behavior
I expect
skaffold config --kube-context set default-repoto work.Actual behavior
Configured
default-repofor the kube context is ignored and thelocal-registry-hostingvalue from the cluster is used instead.Information
Dockerfile:
FROM nginxdeployment.yaml:
Steps to reproduce the behavior
k3d cluster create --registry-create=test-registry.localhost -p 5000skaffold config --kube-context=k3d-k3s-default set default-repo test-registry.localhost:5000skaffold --kube-context=k3d-k3s-default runlocalhost:xxxxrepo name in the image tag rather thantest-registry.localhost:5000hostfield from:kubectl --context=k3d-k3s-default get cm -n kube-public local-registry-hosting -o yamlI think the reason for this is that the default repo is only used from the command line options here. I think if this code block was duplicated for the default repo option, that might work.