GoogleContainerTools / GoogleContainerTools/skaffold

Deploying with a hook command, without any manifests

Open
#8,396 0 comments 0 reactions 0 assignees View on GitHub
area/deploy kind/friction priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

I'd like to be able to deploy OpenFaaS functions via HTTP/REST using `faas-cli deploy`. This does work using an after hook, but a spurious and unnecessary Kubernetes YAML file is required, which makes using Skaffold confusing for users.

```yaml
apiVersion: skaffold/v4beta2
kind: Config
metadata:
name: quick
build:
tagPolicy:
inputDigest: {}
artifacts:
- image: alexellis2/quick
custom:
buildCommand: |
sed 's/SKAFFOLD_IMAGE/IMAGE/g' ./stack.yml > /tmp/stack.yml
DOCKER_BUILDKIT=1 faas-cli publish -f /tmp/stack.yml
dependencies:
paths:
- ./quick/**/
hooks:
before:
- command: ["kubectl", "delete", "job", "quick", "--ignore-not-found=true"]
after:
- command: ["faas-cli", "deploy"]
manifests:
rawYaml:
- ./warmup.yaml

```

### Actual behavior

A dummy deployment file is required with 0 replicas i.e.

```
apiVersion: apps/v1
kind: Deployment
metadata:
name: quick-warmup
namespace: openfaas-fn
labels:
app: quick
spec:
replicas: 0
selector:
matchLabels:
app: quick
template:
metadata:
labels:
app: quick
spec:
containers:
- name: quick
image: alexellis2/quick
command: ["fwatchdog", "--version"]
ports:
- containerPort: 8080
```

OpenFaaS stack.yml

```yaml
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
quick:
lang: node16
handler: ./quick
image: ${SKAFFOLD_IMAGE:-alexellis2/quick:latest}
```

### Steps to reproduce the behavior

```
skaffold version
v2.1.0
```

Full example plus additional context on the current issues: https://github.com/alexellis/openfaas-skaffold-faas-cli

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.