Commit Graph

177 Commits

Author SHA1 Message Date
Matej Vašek 8e0b752edc
Apply linter suggestions (#2786)
* Refactor: if-elif-else => switch

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: calls to embedded fields

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix: add missing err checks

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: fix format of error messages

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: omit type where possible

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: apply De Morgan's law

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: call ReplaceAll where possible

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: fix format of error messages

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Cleanup: fix format of error messages

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
2025-04-15 09:43:13 +00:00
Luke Kingland 9f6a135702
Python Middleware v2 Scaffolding (#2685)
* refactor python http template

* python http scaffolding

* add python to make update-runtimes

* integrate python scaffolding with func run

* python http template

* reorganize python scaffolding

* cancellation stopgap

* documentation and logging cleanup

* Python Middleware v2 - Scaffolding

* base layer cache

* remove wsgi and flask templates

Inbuilt templates should be limited to a base http and cloudevent
integration, with anything beyond this falling to the officially
supported functions samples repository.

* update python cloudevents runtime in makefile

* python cloudevents middleware

* add python .venvs to gitignore

* clean up venvs on make

* add missing dependencies to python http tempklate

* set python cloudevents manifest

* further cleanup of repository impl

* cleanup

* ignore venv when building runtime container

* set listen address on python container

* remove unnecessary python runtime update from makefile

* remove debug statements and improved comments

* enable scaffolding python funcs in s2i builder

* set listen address on all containers built by s2i

* python s2i integration

* regen fs

* cleanup

* enable host builder

* fix manifest inheritance

* regen fs

* bug fixes

* regen docs

* cleanup and linter error fixes

* conditional python host builder test

* misspellings

* disable python E2E

Until the Python middleware is supported by the Pack builder, the E2E
tests will need to be disabled.

* install python for presubmit tests

* use linux for test builder runs

The target platform for a test needs to be a platform which is available
in all test base images.  That's usually linux.  Using current OS would
fail, for example, building python containers on MacOS because the
official Python base image has no darwin layer.

* fix ineffasign

* set python ce template to python 3.9

* regen fs

* windows python tests

* python templates README
2025-04-02 10:44:05 +00:00
Shubham Rasal e9dfba995c
Update CONTRIBUTING.md (#2755)
Typo fixes.
2025-03-20 11:45:16 +00:00
Luke Kingland 1d26629b51
feat: remote storage class (#2693)
* feat: remote storage class

* why isn't the schema regenerated on each make
2025-02-19 07:35:47 +00:00
Matej Vašek a2a97dbd85
Fix linter issues (#2420)
* chore: fixed typos

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* chore: removed trailing whitespaces

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* chore: added EoLs at EoFs

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
2024-07-09 13:48:22 +00:00
Matej Vašek 3e8dc4ddc1
feat: embed tkn tasks in func binary (#2396)
* feat: embed tkn tasks in func binary

Embed Tekton tasks for direct on cluster build.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* feat: embed tkn tasks in func binary

Embed Tekton tasks for PaC build.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* feat: added tkn-tasks sub-command

This new command prints tektons tasks in form of multi-document yaml,
these tekton tasks may requird to be installed for some advanced
functionality.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* chore: remove unused files

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* feat: make deployer image settable via linker

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
2024-06-26 17:48:06 +00:00
Swastik Gour 2ac73da081
corrected doc (#2368)
Signed-off-by: swastik959 <Sswastik959@gmail.com>
2024-06-17 06:00:48 +00:00
Matej Vašek 2e7154ca84
Optimized disk usage in GH Action for integration tests (#2355)
* tests: remote unncessary software from GH VM

Previously tests were failing with no space left on device.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fixup: updated generated code

The codegen should have been updated in prior PR but we forget do do it
there.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* test: wait for gitlab setting effect

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
2024-06-11 18:47:42 +00:00
Matej Vašek f7451b1a9a
chore: use codegen script for docs (#2352)
* chore: use codegen script for docs

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fixup: codegen updated docs

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
2024-06-11 13:25:48 +00:00
Matthias Wessendorf 7914454763
make was not called #2234 (#2245)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2024-03-27 16:45:19 +00:00
Matthias Wessendorf 8ced6269af
Usage of only proper handler API, no longer need for redundant Context (#2249)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2024-03-26 12:05:16 +00:00
Matthias Wessendorf e0a8a2840f
Updates to MD file (#2169)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
2024-02-19 08:11:44 +00:00
Jefferson Ramos 7f44e712b3
doc: update func subscribe doc (#2113) 2024-01-11 07:05:16 +00:00
Matthias Wessendorf 5bb373ab2c
Adding support for `func subscribe` for creating mutiple triggers, based on event filters (#2001)
* Adding support for `func subscribe` for creating mutiple triggers, based on event filters

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* Update cmd/subscribe.go

Co-authored-by: Luke Kingland <luke@lukekingland.com>

* removing unused import

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* running make

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Some import ogranization

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Change argument syntax

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* changes

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Adding some emoji text

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* 💄 move subscriptions underneath the deploy element

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* adding silly emoji to build

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Adding some simple/copied/modified test

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Running 'make schema-generate'

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Update function

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Little unit test

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Adding a bit more help text

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* misspell instruction

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

---------

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Luke Kingland <luke@lukekingland.com>
2023-11-06 13:56:38 +00:00
Nitish Chauhan e04c1392c1
Improving func environment command (#1935)
* improvising func environment command

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* running goimport

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* resolving describing non-running function

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

---------

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
2023-08-18 21:33:18 +00:00
David Fridrich 5135a9205b
typos (#1936)
Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2023-08-17 19:11:42 +00:00
Matej Vasek b98bb9bdcd
doc: Go and Rust on cluster build is supported (#1923)
* doc: Go and Rust on cluster build is supported

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* doc: build envvars

Signed-off-by: Matej Vasek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-08-12 14:10:41 +00:00
Luke Kingland 4e0db21b34
rename knative-sandbox (#1905)
* rename knative-sandbox

* fixup bad merge

* fixup: use knative.dev not github.com import path

---------

Co-authored-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <matejvasek@gmail.com>
2023-08-05 02:11:08 +00:00
Shashank Sharma 2463202f11
allowing on cluster build for go runtime (#1445)
* allowing on cluster build for go runtime

* warning message added for go and rust builder

* gofmt

* fixups

Signed-off-by: Matej Vasek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <mvasek@redhat.com>
2023-07-28 12:02:10 +00:00
Zbynek Roubalik 79c36eefdc
use Tekton Resolvers for a standard on cluster build (#1843)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-07-11 17:41:13 +00:00
Nitish Chauhan f93b23290c
adding service account support (#1812)
* adding service account support

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* correcting formatting

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

---------

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <mvasek@redhat.com>
2023-06-21 07:44:35 +00:00
Sascha Grunert c1a90f65f2
Add support for `serviceAccountName` on deploy (#1811)
This allows setting the service account for the resulting knative
service, which must pre-exist in the namespace to let the deployment
succeed.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-06-19 16:46:54 +00:00
Nitish Chauhan d3a6d6c60c
adding default builders (#1796)
* adding default builders

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* adding yaml format output option

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* fixing typo

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* making changes in flag

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

---------

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
2023-06-14 17:01:46 +00:00
Nitish Chauhan 890d440037
added shorthand -R for --remote flag (#1797)
Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
2023-06-09 18:54:59 +00:00
Luke Kingland 895226fccc
src: remove date from version (#1776)
In an effort to move one step closer to reproducible builds, the date of
compliation is removed from the binary.
2023-06-05 09:50:41 +00:00
Luke Kingland bb599f00f9
fix: PVCSize resets to default (#1771)
Refactors PVCSize to treat the Function member as a custom setting,
and the in-code constant as the default.

- Fixes a bug where the PVCSize would reset to the default on deploy
- Allows the default to be changed by future func version, only pinning
  the value if explicitly requested by the user.
2023-06-05 09:43:41 +00:00
Lance Ball fea4a72734
feat: adds a `func environment` command (#1761)
* feat: adds a `func environment` command

Adds `func environment` to print the current function execution
environment as JSON.

See: https://github.com/knative/func/discussions/1676

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: add environment variables

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: add cluster host

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: review feedback

Signed-off-by: Lance Ball <lball@redhat.com>

---------

Signed-off-by: Lance Ball <lball@redhat.com>
2023-05-31 12:36:35 +00:00
Luke Kingland e9385f3bf2
docs: regen domain docs (#1731) 2023-05-11 13:13:03 +00:00
Lance Ball 607853b6db
chore: update docs from changes to deploy/run (#1715)
The docs were overlooked in the changes to deploy and run in
https://github.com/knative/func/pull/1693. This commit just updates the
docs so they are consistent with the binary.

Signed-off-by: Lance Ball <lball@redhat.com>
2023-05-02 13:08:55 +00:00
Luke Kingland 3ac1ef9229
docs: standardize env flag help suffix (#1689)
* remove 'Env:' prefix from command help text environment variables

* regen docs
2023-04-25 13:56:45 +00:00
Lance Ball 177c15bfb3
feat: custom health checks for node and typescript (#1682)
* feat: custom health checks for node and typescript

This commit bumps the faas-js-runtime for Node.js and TypeScript
dependencies to version 1.1.0, which includes an API allowing function
developers to override the liveness and readiness checks for their
functions.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup

Signed-off-by: Lance Ball <lball@redhat.com>

---------

Signed-off-by: Lance Ball <lball@redhat.com>
2023-04-25 06:31:44 +00:00
Lance Ball d0ebdb78f3
docs: add preliminary document for function lifecycles (#1654)
Signed-off-by: Lance Ball <lball@redhat.com>
2023-04-25 06:07:44 +00:00
Lumír 'Frenzy' Balhar 36d7b23b66
Add Python templates for gunicorn and uwsgi + Flask (#1655)
* Add Python templates for gunicorn and uwsgi + Flask

These templates represents the most common and simple ways
how to implement FAAS in Python either directly via gunicorn
or using Flask and uwsgi.

* feat: runtime envvar definition in templates

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup: use APP_MODULE not app.sh

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup: update docs

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* test: better diffing in tests

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup: update tests

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup: style

Signed-off-by: Matej Vasek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <mvasek@redhat.com>
2023-04-10 19:03:48 +00:00
Matej Vasek d7660abb3f
doc: refer specific verision of Tekton not latest (#1669)
* doc: refer specific verision of Tekton not latest

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fixup: shell-check

Signed-off-by: Matej Vasek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-04-05 16:51:38 +00:00
Adam Boczek 2502819b61
feat: add pvc-size flag to deploy command (#851) (#1598)
* feat: add pvc-size flag to deploy command (#851)

* feat: move pvc-size from deploy to build func configuration section (#851)

* feat: add setting default value for pvc-size in func.yaml (#851)

* feat: change pvc-size to camel case (#851)

* feat: add omitempty to pvcSize (#851)

* feat: regenerate func yaml schema (#851)

* feat: update docs for deploy command (#851)

* feat: update usage help for the pvc-size flag (#851)
2023-04-05 11:54:39 +00:00
Manoel Marques 55f3d241dd
Include --builder option on func run command (#1614) 2023-03-14 08:23:57 +00:00
Dhruv Garg b03ada6c0d
docs: update broken links in docs to command.txt and command.md (#1613) 2023-03-10 17:50:24 +00:00
Manoel Marques fa3286ccac
Change 'create' help text to indicate mandatory language option (#1607) 2023-03-08 17:41:21 +00:00
Marcos Nils cc34d0bc83
docs: add note about not supported on cluster build runtimes. (#1597)
* Add note about not supported on cluster build runtimes.

* fix typo

* remove quarkus from list
2023-03-07 19:58:19 +00:00
Luke Kingland aa582dad21
cli help text updates and flags cleanup (#1564)
* cli help text and flags cleanup

- verbose flag uses global setting throughout
- confirm flag added using shared visitor throughout
- path flag added using shared visitor throughout
- removes --version flag on root as redundant with subcommand
- splits main help's 'Main Commands' into 'Primary Commands' and 'Development
  Commands' groups
- Moves RunE definition into flag struct literals

* remove commented code
2023-03-01 09:35:54 +00:00
Lance Ball 44bb13f803
feat: adds refspec support for `func repo add` (#1558)
* add option 'branch' to command 'repository add'

* Format go code (#1407)

Signed-off-by: Knative Automation <automation@knative.team>

* chore: refactor repository layout (#1554)

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

* fixup: removes --branch tag from repo commands

Removes the currently in-flight work on the `--branch` tag, simply
supporting a `refspec` on the repository URI. For example,
https://github.com/knative-sandbox/func-tastic#metacontroller will pull
the `func-tastic` repo, and set the currently active HEAD to the
`metacontroller` branch. Adds support for displaying this with the
command `func repo list -v`.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: add example to `func repo add` documentation

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: adjust test output expectations

Signed-off-by: Lance Ball <lball@redhat.com>

---------

Signed-off-by: Knative Automation <automation@knative.team>
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Co-authored-by: Yingchun Guo <yingchun.guo@intel.com>
Co-authored-by: knative-automation <automation@knative.team>
Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-16 04:05:51 +00:00
Zbynek Roubalik 5a4803bf95
chore: refactor repository layout (#1554)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-15 08:46:52 +00:00
Luke Kingland 958429c2f3
feat: deploy command global config with function context (#1434)
* feat: deploy command global config function context

* fix static check errors

* fix test

* fix remote persists test

* env opaque box test

* use keyed fields (govet)

* mock deployer expansion

* ClearEnvs now in shared testing pkg

* effectivePath now uses plfags

* list directly uses config for default namespace

* Improved Namespace calculation and Caching

- Built() now a client package function
- Namespace evaluation delegeate to implementations
  This enables the func.yaml to avert dirtiness checks on rebuilds
  (caching)
- Build and Deploy update build stamp on completion
  Enables dirtiness checks to be unaffects, leading to better caching.
- CLI Namespace checks no longer require k8s env evaluation for default
- Fixed missing condition check in TestDeploy_Namespace
- Fixes some minor linter and spelling errors
- Global config does not directly set namespace - it is corrected to be
  deferred evaluation used by implementations.
- Skips writing func.yaml on f.Write if there were no modifications,
  which leads to better caching (no timestamp update means Built ==
  true)
- HasImage removed in favor of a corrected fn.Built

* linting, misspellings and docs rebuild

* warn user if git settings exist on a non-remote build

* lint error fix

* test flag unsetting persists

* allow unknown flags in preparsing of flags

* pre-submit cleanup

* update cmd to use client.Init
2023-02-06 08:43:35 +00:00
Luke Kingland be2e9ee970
rebuild docs (#1517) 2023-01-24 12:59:38 +00:00
Thomas Risberg 63aab77884
Update Spring Boot to 2.7.7 (#1502)
* Update Spring Boot to 2.7.7

- also add function-template springboot.md doc

Signed-off-by: Thomas Risberg <trisberg@pivotal.io>

* Fix lint errors

Signed-off-by: Thomas Risberg <trisberg@pivotal.io>
2023-01-18 19:30:03 +00:00
Lance Ball d3d3233825
docs: update language pack docs for builderImages (#1497)
Includes guidance for Language Pack authors creating templates that use
runtimes other than those that are built in to the CLI.

Signed-off-by: Lance Ball <lball@redhat.com>

Signed-off-by: Lance Ball <lball@redhat.com>
2023-01-16 21:01:04 +00:00
Adam Boczek 2f021f118b
chore: refactor commands help to use templates (#1485)
* chore: extend help template engine and docs generator to get root use

* chore: refactor deploy cmd

* chore: refactor build cmd

* chore: refactor all relevant commands and remove defaultTemplatedHelp func

* chore: update docs

* chore: remove unused functions

* chore: add template func for rendering sub-templates

* chore: fix for typos
2023-01-16 20:40:53 +00:00
Zbynek Roubalik e3b7ff4404
docs: update on cluster build guide to explicitly mention `--remote` flag (#1455)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-12-07 16:34:14 +00:00
Luke Kingland eae7d56895
feat: command function context (#1416)
* feat: global config function context

The function with context is considered when determining flag defaults
such that:
- No special logic is required to determine "if changed"
- help text correctly reflects the actual values which will be used
- Global config can be a direct parent of command-specific config via
  embed
Also included:
- CLI tests clear environment of FUNC_* variables
- Command's bindEnv helper also sets up environment variable auto-binding
  and prefix.
- Verbosisty flag default now globally configurable

* Update cmd/build.go

Co-authored-by: Lance Ball <lball@redhat.com>

* Update cmd/build.go

Co-authored-by: Lance Ball <lball@redhat.com>

* Update cmd/build.go

Co-authored-by: Lance Ball <lball@redhat.com>

* move clearEnvs test function to test file

* docs regen

Co-authored-by: Lance Ball <lball@redhat.com>
2022-11-21 18:50:42 +00:00
Luke Kingland 5ca77d3874
src: update build command help text (#1425)
* src: build command help text

* Regen docs
2022-11-16 14:18:38 +00:00