This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.11.2.2. 関数の作成
関数をビルドし、デプロイする前に、Knative (kn) CLI を使用して関数を作成する必要があります。コマンドラインでパス、ランタイム、テンプレート、およびイメージレジストリーをフラグとして指定するか、-c フラグを使用してターミナルで対話型エクスペリエンスを開始できます。
前提条件
- OpenShift Serverless Operator および Knative Serving がクラスターにインストールされている。
-
Knative (
kn) CLI をインストールしている。
手順
関数プロジェクトを作成します。
kn func create -r <repository> -l <runtime> -t <template> <path>
$ kn func create -r <repository> -l <runtime> -t <template> <path>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
受け入れられるランタイム値には、
node、go、python、quarkus、およびtypescriptが含まれます。 受け入れられるテンプレート値には、
httpとeventsが含まれます。コマンドの例
kn func create -l typescript -t events examplefunc
$ kn func create -l typescript -t events examplefuncCopy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
Project path: /home/user/demo/examplefunc Function name: examplefunc Runtime: typescript Template: events Writing events to /home/user/demo/examplefunc
Project path: /home/user/demo/examplefunc Function name: examplefunc Runtime: typescript Template: events Writing events to /home/user/demo/examplefuncCopy to Clipboard Copied! Toggle word wrap Toggle overflow または、カスタムテンプレートを含むリポジトリーを指定することもできます。
コマンドの例
kn func create -r https://github.com/boson-project/templates/ -l node -t hello-world examplefunc
$ kn func create -r https://github.com/boson-project/templates/ -l node -t hello-world examplefuncCopy to Clipboard Copied! Toggle word wrap Toggle overflow 出力例
Project path: /home/user/demo/examplefunc Function name: examplefunc Runtime: node Template: hello-world Writing events to /home/user/demo/examplefunc
Project path: /home/user/demo/examplefunc Function name: examplefunc Runtime: node Template: hello-world Writing events to /home/user/demo/examplefuncCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
受け入れられるランタイム値には、