Skip to content

Remove old generators and add generation from store for output type stack/stack.yaml - #1032

Merged
alexellis merged 5 commits into
masterfrom
remove-knative
Sep 29, 2026
Merged

alexellis merged 5 commits into
masterfrom
remove-knative

Conversation

@alexellis

@alexellis alexellis commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Remove the deprecated generators from faas-cli generate:

  • Drop older schema / CRD generation.
  • Reject any --api value other than openfaas.com/v1 and openfaas.com/v2alpha2, rather than stamping it straight into the generated CRD
  • Add --output stack.yaml (alias stack) for generate --from-store, which scaffolds an OpenFaaS stack.yaml with skip_build: true for a store image, ready to edit and then deploy

Why

Scaffolding a stack.yaml for a store function is a common starting point for overriding a pre-built deployment, such as adding OAuth environment variables and secrets before running deploy.

Notes

  • Breaking: --api=serving.knative.dev/v1 now errors with the list of supported versions
  • fprocess from store items is emitted through environment only, matching how deploy and the watchdog consume it
  • Table tests added for preRunGenerate (API and output validation) and generateStackYAML, full suite passes

The generate command no longer supports the serving.knative.dev/v1
API version. Drop the Knative Serving generator, its env ordering
helper, and references from the --api flag help text and examples.

Functions should be generated with the openfaas.com CRDs instead.
The schema/knative package is now unused and will be deleted
separately.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Remove the schema/knative/v1 package containing the ServingService
CRD types, now that the generate command no longer emits Knative
Serving resources.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Only openfaas.com/v1 and openfaas.com/v2alpha2 are supported by the
generate command. Any other API version was previously accepted and
stamped straight into the generated CRD, producing YAML that would
not apply. Reject unknown values in preRunGenerate with the list of
supported versions.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Scaffolding a stack.yaml for a store function is a common starting
point for overriding a pre-built deployment, such as adding OAuth
environment variables and secrets before running deploy.

Add an --output flag accepting stack.yaml (or its stack alias), which
emits an OpenFaaS stack.yaml for the store function instead of a
Function CR. The generated file carries the store image, merged
labels, annotations and environment, and sets skip_build so the
pre-built image is used without a rebuild.

The flag is only valid alongside --from-store, and is rejected
otherwise. Output types are declared locally so empty values are
omitted, keeping the scaffold minimal for editing afterwards.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Move the check that --output stack.yaml requires --from-store out of
runGenerate and into preRunGenerate, where the rest of the flag
validation lives. Unknown output formats are now rejected rather
than silently ignored, and the --name help no longer refers to a
Function CR, which is not what stack output generates.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@reviewfn

reviewfn Bot commented Sep 29, 2026

Copy link
Copy Markdown

AI Pull Request Overview

Disclaimer: This review was generated by automated AI and may contain errors. Do not trust its outputs without human verification.

Summary

  • Removes the Knative Serving CRD generation path from faas-cli generate.
  • Restricts --api to openfaas.com/v1 and openfaas.com/v2alpha2 for CRD output.
  • Adds --output stack.yaml and --output stack for generate --from-store.
  • Generates deployable OpenFaaS stack YAML with skip_build: true for store images.
  • Preserves store-provided fprocess by placing it in the generated function environment.
  • Adds table-driven tests for API validation, output validation, and stack YAML generation.

Approval rating (1-10)

8/10. The change is focused and covered by targeted tests; no blocking correctness issues were found in the scoped diff.

Summary per file

Summary per file
File path Summary
commands/generate.go Removes Knative generation, validates APIs, adds store stack YAML output.
commands/generate_test.go Adds tests for API validation, output validation, and generated stack YAML.
schema/knative/v1/serving.go Deletes Knative Serving schema types no longer used by generate.

Overall Assessment

The scoped changes are consistent with the PR goal of removing deprecated Knative generation and making unsupported --api values fail early instead of producing arbitrary CRD output. The new stack YAML mode is limited to --from-store, emits the fields needed for a pre-built image workflow, and avoids duplicating fprocess as both a stack fprocess field and an environment entry. I did not find a concrete blocking defect in the changed code.

Detailed Review

Detailed Review

No blocking findings.

The preRunGenerate validation now rejects empty and unsupported CRD API versions for normal CRD generation, while allowing the new stack output mode to skip API validation because it does not emit CRDs. That separation matches the new behavior introduced by --output stack.yaml.

The generateStackYAML path emits a minimal stack file with version, provider, and functions, including image, skip_build, environment, labels, and annotations. This is compatible with the existing stack parser used in the test and with the deploy path that compiles environment into deployment environment variables.

The Knative schema deletion appears complete within the reviewed scope; the remaining scoped references only use the removed API string in a negative validation test.

AI agent details.

Agent processing time: 1m17.618s
Environment preparation time: 3.795s
Total time from webhook: 1m26.843s

@alexellis
alexellis merged commit 7a39d63 into master Sep 29, 2026
3 checks passed
@alexellis
alexellis deleted the remove-knative branch September 29, 2026 18:29
@alexellis alexellis changed the title Remove Knative support from generate Remove old generators and add generation from store for output type stack/stack.yaml Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant