Skip to content

Commit 03ea2fd

Browse files
authored
add all deployers to remote build (#3421)
1 parent 46b196c commit 03ea2fd

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

cmd/func-util/main.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"knative.dev/func/pkg/buildpacks"
2222
fn "knative.dev/func/pkg/functions"
2323
"knative.dev/func/pkg/k8s"
24+
"knative.dev/func/pkg/keda"
2425
"knative.dev/func/pkg/knative"
2526
"knative.dev/func/pkg/s2i"
2627
"knative.dev/func/pkg/scaffolding"
@@ -157,14 +158,31 @@ func deploy(ctx context.Context) error {
157158
if f.Deploy.Image == "" {
158159
f.Deploy.Image = f.Image
159160
}
161+
if f.Deploy.Deployer == "" {
162+
f.Deploy.Deployer = knative.KnativeDeployerName
163+
}
164+
var d fn.Deployer
165+
switch f.Deploy.Deployer {
166+
case knative.KnativeDeployerName:
167+
d = knative.NewDeployer(
168+
knative.WithDeployerDecorator(deployDecorator{}),
169+
knative.WithDeployerVerbose(true),
170+
)
171+
case k8s.KubernetesDeployerName:
172+
d = k8s.NewDeployer(
173+
k8s.WithDeployerDecorator(deployDecorator{}),
174+
k8s.WithDeployerVerbose(true),
175+
)
176+
case keda.KedaDeployerName:
177+
d = keda.NewDeployer(
178+
keda.WithDeployerDecorator(deployDecorator{}),
179+
keda.WithDeployerVerbose(true),
180+
)
181+
default:
182+
return fmt.Errorf("unknown deployer: %s", f.Deploy.Deployer)
183+
}
160184

161-
client := fn.New(
162-
fn.WithDeployer(
163-
knative.NewDeployer(
164-
knative.WithDeployerDecorator(deployDecorator{}),
165-
knative.WithDeployerVerbose(true)),
166-
),
167-
)
185+
client := fn.New(fn.WithDeployer(d))
168186
res, err := client.Deploy(ctx, f, fn.WithDeploySkipBuildCheck(true))
169187
if err != nil {
170188
return fmt.Errorf("cannot deploy the function: %w", err)

0 commit comments

Comments
 (0)