knative / func

Knative Functions client API and CLI
Apache License 2.0
276 stars 138 forks source link

Exporting Knative Service when requested in the CLI using --dry-run #1060

Open salaboy opened 2 years ago

salaboy commented 2 years ago

As discussed in this issue: https://github.com/knative-sandbox/kn-plugin-func/issues/817 As discussed in the weekly meeting

The func CLI should:

This will allow users to save the resource and apply it manually if they want to override some configurations.

salaboy commented 2 years ago

After trying to create my own --dry-run printers I've realized that there is a "similar" functionality in kn that we can/should use.

The kn cli already provides a sort of dry run with the --target parameter which dumps the output of commands into a file. They also have knServingGitOpsClient which is an alternative implementation of the Knative serving clients that do all the dumping resources to files.

@zroubalik I am not sure if you have looked into the on-cluster build dry runs.. but so far I think that we should reuse the kn cli mechanisms.

I've started to think that my first implementation will follow the same approach of asking for a --target flag which points to a file where the resources are going to be written. This in my opinion is not very "gitops-y", but I do understand some of the reasons why this might have been designed in this way. From what I understand looking at the kn code when --target is provided nothing is applied to the cluster.

Internally this is using &printers.YAMLPrinter{} to print YAMLs with different options.

@lance @lkingland @matejvasek any thoughts?

salaboy commented 2 years ago

Quick update, I've written a comment on the client issue linked above to see if we can expand the kn client capabilities so we can reuse them here in func. I will create a draft PR in the meantime.

salaboy commented 2 years ago

https://github.com/knative/client/issues/1195

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

zroubalik commented 1 year ago

/remove-lifecycle stale

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

matejvasek commented 3 months ago

/remove-lifecycle stale

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.