Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"

"github.com/ory/viper"
"knative.dev/func/pkg/keda"

"knative.dev/func/cmd/prompt"
"knative.dev/func/pkg/buildpacks"
Expand Down Expand Up @@ -68,9 +69,9 @@ func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func()) {
fn.WithRepositoriesPath(config.RepositoriesPath()),
fn.WithScaffolder(buildpacks.NewScaffolder(cfg.Verbose)),
fn.WithBuilder(buildpacks.NewBuilder(buildpacks.WithVerbose(cfg.Verbose))),
fn.WithRemovers(knative.NewRemover(cfg.Verbose), k8s.NewRemover(cfg.Verbose)),
fn.WithDescribers(knative.NewDescriber(cfg.Verbose), k8s.NewDescriber(cfg.Verbose)),
fn.WithListers(knative.NewLister(cfg.Verbose), k8s.NewLister(cfg.Verbose)),
fn.WithRemovers(knative.NewRemover(cfg.Verbose), k8s.NewRemover(cfg.Verbose), keda.NewRemover(cfg.Verbose)),
fn.WithDescribers(knative.NewDescriber(cfg.Verbose), k8s.NewDescriber(cfg.Verbose), keda.NewDescriber(cfg.Verbose)),
fn.WithListers(knative.NewLister(cfg.Verbose), k8s.NewLister(cfg.Verbose), keda.NewLister(cfg.Verbose)),
fn.WithDeployer(d),
fn.WithPipelinesProvider(pp),
fn.WithPusher(docker.NewPusher(
Expand Down Expand Up @@ -170,6 +171,15 @@ func newK8sDeployer(verbose bool) fn.Deployer {
return k8s.NewDeployer(options...)
}

func newKedaDeployer(verbose bool) fn.Deployer {
options := []keda.DeployerOpt{
keda.WithDeployerVerbose(verbose),
keda.WithDeployerDecorator(deployDecorator{}),
}

return keda.NewDeployer(options...)
}

type deployDecorator struct {
oshDec k8s.OpenshiftMetadataDecorator
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/completion_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/spf13/cobra"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
"knative.dev/func/pkg/keda"
"knative.dev/func/pkg/knative"
)

Expand Down Expand Up @@ -170,6 +171,7 @@ func CompleteDeployerList(cmd *cobra.Command, args []string, complete string) (m
deployers := []string{
knative.KnativeDeployerName,
k8s.KubernetesDeployerName,
keda.KedaDeployerName,
}

d = cobra.ShellCompDirectiveNoFileComp
Expand Down
16 changes: 13 additions & 3 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
"knative.dev/func/pkg/keda"
"knative.dev/func/pkg/knative"
"knative.dev/func/pkg/utils"
)
Expand Down Expand Up @@ -131,7 +132,7 @@ EXAMPLES
PreRunE: bindEnv("build", "build-timestamp", "builder", "builder-image",
"base-image", "confirm", "domain", "env", "git-branch", "git-dir",
"git-url", "image", "namespace", "path", "platform", "push", "pvc-size",
"service-account", "deployer", "registry", "registry-insecure",
"service-account", "deployer", "cluster-domain", "registry", "registry-insecure",
"registry-authfile", "remote", "username", "password", "token", "verbose",
"remote-storage-class"),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -195,7 +196,9 @@ EXAMPLES
cmd.Flags().String("service-account", f.Deploy.ServiceAccountName,
"Service account to be used in the deployed function ($FUNC_SERVICE_ACCOUNT)")
cmd.Flags().String("deployer", f.Deploy.Deployer,
fmt.Sprintf("Type of deployment to use: '%s' for Knative Service (default) or '%s' for Kubernetes Deployment ($FUNC_DEPLOY_TYPE)", knative.KnativeDeployerName, k8s.KubernetesDeployerName))
fmt.Sprintf("Type of deployment to use: '%s' for Knative Service (default), '%s' for Kubernetes Deployment or '%s' for Deployment with a Keda HTTP scaler ($FUNC_DEPLOY_TYPE)", knative.KnativeDeployerName, k8s.KubernetesDeployerName, keda.KedaDeployerName))
cmd.Flags().String("cluster-domain", f.Deploy.ClusterDomain,
"Kubernetes cluster domain for service DNS resolution. Defaults to 'cluster.local' ($FUNC_CLUSTER_DOMAIN)")
// Static Flags:
// Options which have static defaults only (not globally configurable nor
// persisted with the function)
Expand Down Expand Up @@ -534,6 +537,9 @@ type deployConfig struct {
// Deployer specifies the type of deployment: "knative" or "raw"
Deployer string

// ClusterDomain specifies the Kubernetes cluster domain for service DNS resolution
ClusterDomain string

// Remote indicates the deployment (and possibly build) process are to
// be triggered in a remote environment rather than run locally.
Remote bool
Expand Down Expand Up @@ -568,6 +574,7 @@ func newDeployConfig(cmd *cobra.Command) deployConfig {
Timestamp: viper.GetBool("build-timestamp"),
ServiceAccountName: viper.GetString("service-account"),
Deployer: viper.GetString("deployer"),
ClusterDomain: viper.GetString("cluster-domain"),
}
// NOTE: .Env should be viper.GetStringSlice, but this returns unparsed
// results and appears to be an open issue since 2017:
Expand Down Expand Up @@ -603,6 +610,7 @@ func (c deployConfig) Configure(f fn.Function) (fn.Function, error) {
f.Build.RemoteStorageClass = c.RemoteStorageClass
f.Deploy.ServiceAccountName = c.ServiceAccountName
f.Deploy.Deployer = c.Deployer
f.Deploy.ClusterDomain = c.ClusterDomain
f.Local.Remote = c.Remote

// PVCSize
Expand Down Expand Up @@ -799,8 +807,10 @@ func (c deployConfig) clientOptions() ([]fn.Option, error) {
o = append(o, fn.WithDeployer(newKnativeDeployer(c.Verbose)))
case k8s.KubernetesDeployerName:
o = append(o, fn.WithDeployer(newK8sDeployer(c.Verbose)))
case keda.KedaDeployerName:
o = append(o, fn.WithDeployer(newKedaDeployer(c.Verbose)))
default:
return o, fmt.Errorf("unsupported deploy type: %s (supported: %s, %s)", deployer, knative.KnativeDeployerName, k8s.KubernetesDeployerName)
return o, fmt.Errorf("unsupported deploy type: %s (supported: %s, %s, %s)", deployer, knative.KnativeDeployerName, k8s.KubernetesDeployerName, keda.KedaDeployerName)
}

return o, nil
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/func_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ func deploy
--build-timestamp Use the actual time as the created time for the docker image. This is only useful for buildpacks builder.
-b, --builder string Builder to use when creating the function's container. Currently supported builders are "host", "pack" and "s2i". (default "pack")
--builder-image string Specify a custom builder image for use by the builder other than its default. ($FUNC_BUILDER_IMAGE)
--cluster-domain string Kubernetes cluster domain for service DNS resolution. Defaults to 'cluster.local' ($FUNC_CLUSTER_DOMAIN)
-c, --confirm Prompt to confirm options interactively ($FUNC_CONFIRM)
--deployer string Type of deployment to use: 'knative' for Knative Service (default) or 'raw' for Kubernetes Deployment ($FUNC_DEPLOY_TYPE)
--deployer string Type of deployment to use: 'knative' for Knative Service (default), 'raw' for Kubernetes Deployment or 'keda' for Deployment with a Keda HTTP scaler ($FUNC_DEPLOY_TYPE)
--domain string Domain to use for the function's route. Cluster must be configured with domain matching for the given domain (ignored if unrecognized) ($FUNC_DOMAIN)
-e, --env stringArray Environment variable to set in the form NAME=VALUE. You may provide this flag multiple times for setting multiple environment variables. To unset, specify the environment variable name followed by a "-" (e.g., NAME-).
-t, --git-branch string Git revision (branch) to be used when deploying via the Git repository ($FUNC_GIT_BRANCH)
Expand Down
42 changes: 24 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module knative.dev/func

go 1.24.4
go 1.24.7

// this is required bacause of bad dep in github.com/openshift-pipelines/pipelines-as-code
replace github.com/imdario/mergo => dario.cat/mergo v1.0.1
Expand All @@ -9,6 +9,10 @@ replace github.com/imdario/mergo => dario.cat/mergo v1.0.1
// Issue: https://github.com/tektoncd/pipeline/issues/8969
replace knative.dev/pkg => knative.dev/pkg v0.0.0-20250716115900-19d3cc2da0b9

// Override invalid k8s.io/client-go v1.5.2 requirement from keda http-add-on
// keda uses a replace directive internally, but those don't propagate to dependents
replace k8s.io/client-go => k8s.io/client-go v0.34.3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR to resolve this in the KHA is open and will probably be released next week, just need to fix CI, see kedacore/http-add-on#1424

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks a lot


require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/BurntSushi/toml v1.5.0
Expand Down Expand Up @@ -38,6 +42,7 @@ require (
github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95
github.com/heroku/color v0.0.6
github.com/hinshun/vt10x v0.0.0-20220228203356-1ab2cad5fd82
github.com/kedacore/http-add-on v0.11.1
github.com/manifestival/client-go-client v0.6.0
github.com/manifestival/manifestival v0.7.2
github.com/modelcontextprotocol/go-sdk v1.1.0
Expand Down Expand Up @@ -67,8 +72,9 @@ require (
gotest.tools/v3 v3.5.2
k8s.io/api v0.34.3
k8s.io/apimachinery v0.34.3
k8s.io/client-go v0.34.3
k8s.io/client-go v1.5.2
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
knative.dev/client/pkg v0.0.0-20260122022411-b55a7dbd440d
knative.dev/eventing v0.47.1-0.20260120164810-71a6c9ffdee2
knative.dev/hack v0.0.0-20260120115810-bf6758cba446
Expand All @@ -93,7 +99,7 @@ require (
github.com/Azure/go-autorest/logger v0.2.2 // indirect
github.com/Azure/go-autorest/tracing v0.6.1 // indirect
github.com/GoogleContainerTools/kaniko v1.24.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Microsoft/hcsshim v0.13.0 // indirect
github.com/ProtonMail/go-crypto v1.2.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
Expand Down Expand Up @@ -148,20 +154,20 @@ require (
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/gdamore/encoding v1.0.1 // indirect
github.com/gdamore/tcell/v2 v2.8.1 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.1 // indirect
github.com/go-openapi/jsonpointer v0.21.2 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
Expand All @@ -178,6 +184,7 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b // indirect
Expand All @@ -203,7 +210,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
Expand Down Expand Up @@ -231,7 +238,7 @@ require (
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/gomega v1.37.0 // indirect
github.com/onsi/gomega v1.38.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runtime-spec v1.2.1 // indirect
github.com/opencontainers/selinux v1.12.0 // indirect
Expand All @@ -243,7 +250,7 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.4 // indirect
github.com/prometheus/common v1.20.99 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/prometheus/statsd_exporter v0.28.0 // indirect
github.com/rickb777/date v1.20.2 // indirect
Expand Down Expand Up @@ -285,28 +292,27 @@ require (
go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
golang.org/x/text v0.33.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/time v0.13.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/api v0.233.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.77.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
k8s.io/apiextensions-apiserver v0.34.3 // indirect
k8s.io/apiserver v0.34.3 // indirect
k8s.io/cli-runtime v0.34.1 // indirect
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3 // indirect
knative.dev/networking v0.0.0-20260120131110-a7cdca238a0d // indirect
sigs.k8s.io/controller-runtime v0.20.4 // indirect
sigs.k8s.io/gateway-api v1.1.0 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/controller-runtime v0.22.1 // indirect
sigs.k8s.io/gateway-api v1.4.0 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/kustomize/api v0.20.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
Expand Down
Loading