Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kn-plugin-workflow] Minify the openAPI spec files to trim operations only used by the workflows in the current project #2601

Open
Tracked by #1524
ricardozanini opened this issue Sep 18, 2024 · 0 comments
Assignees

Comments

@ricardozanini
Copy link
Member

ricardozanini commented Sep 18, 2024

When users run the command kn workflow create, they can add any OpenAPI specification files to the specs folder. However, large files may exceed Kubernetes' object size limit during deployment. Reference: Kubernetes object size limitations.

To address this, we will introduce a new CLI command:

# Explore additional handlers if needed
kn workflow specs minify openapi

Command Behavior:

  • This command minifies OpenAPI spec files in the specs folder, keeping only the operations and definitions used in the workflows (and sub flows) within the project context.
  • Minified files will be saved with the pattern <original-file-name>.min.yaml|json.
  • All unused operations, types, and objects will be removed from the minified file.

Deployment:

  • The ConfigMaps will reference the minified files when deploying to Kubernetes. Although the ConfigMaps entries will use the original file names (to match references in spec.flow.functions), the content will be the minified version.

Automation:

  • If the user does not run the minify command manually, the process will be triggered automatically before creating ConfigMaps during deployment. This ensures that oversized files do not block deployment.

File Size Validation

  • The minified file must be validated to ensure it does not exceed Kubernetes' 3MB size limit. If it does, users will be prompted to store the OpenAPI files remotely (e.g., via CDN or a Git repository) and reference them using HTTP(S) URLs in the project.

Debugging:

  • The command allows users to manually minify and inspect the OpenAPI specs, offering better debugging and verification before deployment.

Documentation:

  • Ensure all relevant documentation is updated to reflect this new behavior.

Additional Considerations:

Editor Integration: @handreyrc, please verify if this change impacts the editor's functionality. IntelliSense should remain unaffected, as it will continue working with the original, non-minified OpenAPI specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant