GoogleContainerTools / GoogleContainerTools/skaffold

Issues working with kind and ko

Open
#9,609 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

When using the ko builder with my kind cluster, I should be able to:
- use the placeholder ko image name (ko://company.com/very/long/path/to/our/code) so that it's consistent with ko usage
- have that name replaced with a "nice" name (i.e., what ko would do)
- have that name be replaced in my Kubernetes deployment files
- have that image be pushed to kind

### Actual behavior

If I use the placeholder ko image name in `skaffold.yaml`, the image doesn't get loaded into `kind`. It does get replaced in my `knative-service.yaml`. It does not get replaced in my `knative-containersource.yaml`. The generated image name is _awful_, i.e., if it was `ko://company.com/very/long/path/to/our/code`, it comes out as `kind.local/project/company_com_very_long_path_to_our_code`.

If I use a non-placeholder image name, such as "test-image", the image gets loaded into kind. It does get replaced in my `knative-service.yaml`, but doesn't in my `knative-containersource.yaml`. This obviously interferes with ko which isn't suitable for my workflow.

### Information

- Skaffold version: v2.13.2 (I think... latest using Cloud Code)
- Operating system: Ubuntu 24.04.1 LTS using WSL2 on Windows 11 23H2
- Installed via: Cloud Code

- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v4beta11
kind: Config
build:
artifacts:
- image: ko://company.com/very/long/path/to/our/code
ko:
main: ./very/long/path/to/code
dependencies:
paths:
- "**/*.go"
- go.*
manifests:
rawYaml:
- config/backend-container-source.yaml
- config/frontend-knative-service.yaml
deploy:
kubectl: {}
```

- VS Code Launch Configuration:
```json
{
"name": "Kubernetes: Run/Debug",
"type": "cloudcode.kubernetes",
"request": "launch",
"skaffoldConfig": "${workspaceFolder}/skaffold.yaml",
"watch": true,
"cleanUp": true,
"portForward": true,
"imageRegistry": "kind.local/project",
}
```

- knative-service.yaml
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: frontend
spec:
template:
spec:
volumes:
- name: config-volume
configMap:
name: frontend-config
containers:
- name: frontend
image: ko://company.com/very/long/path/to/our/code
ports:
- containerPort: 8080
```

- knative-containersource.yaml
```yaml
apiVersion: sources.knative.dev/v1
kind: ContainerSource
metadata:
name: backend
spec:
sink:
ref:
apiVersion: serving.knative.dev/1
kind: Service
name: frontend
template:
spec:
volumes:
- name: config-volume
configMap:
name: backend-config
containers:
- name: backend
image: ko://company.com/very/long/path/to/our/code
ports:
- containerPort: 40000
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.