GoogleContainerTools / GoogleContainerTools/skaffold

Skaffold builds images before required charts

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

Description

### Context

Hello ! I started using skaffold recently to deploy my cluster locally.
In my cluster, I have some dependencies I need to deploy first (like a docker registry) before building the images needed for the different pods. This is necessary because I want to push hte built images to this docker registry.
To do that, I created a skaffold.yaml file, that requires another file, which deploys all the dependencies.

Here is the skaffold.yaml file :
```yaml
apiVersion: skaffold/v4beta2
kind: Config
metadata:
name: pxt-lets-steam-backend

requires:
- path: deploy/skaffold/cluster-dependencies.yaml

build:
cluster:
concurrency: 1
artifacts:
- image: twuni-docker-registry.docker-registry/pxt-static-server
kaniko:
cleanup: true
dockerfile: Dockerfile.pxt-static-server
insecure : true

- image: twuni-docker-registry.docker-registry/sources-fetcher
kaniko:
cleanup: true
dockerfile: Dockerfile.sources-fetcher
insecure: true

- image: twuni-docker-registry.docker-registry/sources-builder
kaniko:
cleanup: true
dockerfile: Dockerfile.sources-builder
insecure: true

- image: twuni-docker-registry.docker-registry/testent
kaniko:
cleanup: true
dockerfile: Dockerfile.registry-test
insecure: true

deploy:
helm:
releases:
- name: pxt-lets-steam-backend
chartPath: deploy/helm/pxt-lets-steam-backend
valuesFiles:
- deploy/helm/values.yaml
version: 0.1.0
```
And here is my another required skaffold manifest :
```yaml
apiVersion: skaffold/v4beta2
kind: Config
metadata:
name: cluster-dependencies

deploy:
helm:
releases:
- name: cert-manager
repo: https://charts.jetstack.io
remoteChart: cert-manager
namespace: cert-manager
createNamespace: true
setValues:
installCRDs: true

- name: twuni
repo: https://helm.twun.io
remoteChart: docker-registry
namespace: docker-registry
createNamespace: true
setValues:
secrets.htpasswd: root:$apr1$XO7G725y$D8T9MBLl.XBDzIdZdbeaR1

- name: ingress
chartPath: deploy/helm/ingress
valuesFiles:
- deploy/helm/values.yaml
version: 0.1.0

- name: kedacore
repo: https://kedacore.github.io/charts
namespace: keda
createNamespace: true
remoteChart: keda
```

### Expected behavior

When I run `skaffold run`, I would like the required file to deploy first, and then my main skaffold.yaml file to build the needed images / deploy the different k8s resources.

### Actual behavior

When I run `skaffold run`, the images described in my main skaffold.yaml file are built first, and as the docker registry I need to deploy first is not deployed first, skaffold run crashes, and that's sad :((

Here are the logs of the `skaffold run` command
Generating tags...
- twuni-docker-registry.docker-registry/pxt-static-server -> twuni-docker-registry.docker-registry/pxt-static-server:1c0a514-dirty
- twuni-docker-registry.docker-registry/sources-fetcher -> twuni-docker-registry.docker-registry/sources-fetcher:1c0a514-dirty
- twuni-docker-registry.docker-registry/sources-builder -> twuni-docker-registry.docker-registry/sources-builder:1c0a514-dirty
- twuni-docker-registry.docker-registry/testent -> twuni-docker-registry.docker-registry/testent:1c0a514-dirty
Checking cache...
- twuni-docker-registry.docker-registry/pxt-static-server: Not found. Building
- twuni-docker-registry.docker-registry/sources-fetcher: Not found. Building
- twuni-docker-registry.docker-registry/sources-builder: Not found. Building
- twuni-docker-registry.docker-registry/testent: Not found. Building
Starting build...
Building [twuni-docker-registry.docker-registry/testent]...
Target platforms: [linux/amd64]
error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "twuni-docker-registry.docker-registry/testent:1c0a514-dirty": creating push check transport for twuni-docker-registry.docker-registry failed: Get "https://twuni-docker-registry.docker-registry/v2/": dial tcp: lookup twuni-docker-registry.docker-registry on 10.96.0.10:53: no such host; Get "http://twuni-docker-registry.docker-registry/v2/": dial tcp: lookup twuni-docker-registry.docker-registry on 10.96.0.10:53: no such host
Building [twuni-docker-registry.docker-registry/sources-fetcher]...
Target platforms: [linux/amd64]
Build [twuni-docker-registry.docker-registry/sources-fetcher] was canceled
Building [twuni-docker-registry.docker-registry/pxt-static-server]...
Target platforms: [linux/amd64]
Build [twuni-docker-registry.docker-registry/pxt-static-server] was canceled
Building [twuni-docker-registry.docker-registry/sources-builder]...
Target platforms: [linux/amd64]
Build [twuni-docker-registry.docker-registry/sources-builder] was canceled
build [twuni-docker-registry.docker-registry/testent] failed: pod has failed

### Information

- Skaffold version: v2.6.1
- Operating system: Linux Devcontainer (mcr.microsoft.com/devcontainers/typescript-node:18-bullseye)

I don't know if this behaviour is supposed to happen, but if that's the case, I find odd that images are built independently of required resources.

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.