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

Update Composition Functions content to v1beta1 #583

Closed
wants to merge 17 commits into from

Conversation

negz
Copy link
Member

@negz negz commented Oct 25, 2023

Relates to #579
Relates to #582

This PR documents how to use composition functions. It also covers everything I think we need to cover about how they work and how to write them, short of language-specific guides. I plan to add a more detailed language-specific guide for Go that covers function-sdk-go and function-template-go in a separate PR.

@netlify
Copy link

netlify bot commented Oct 25, 2023

Deploy Preview for crossplane ready!

Name Link
🔨 Latest commit b5ff920
🔍 Latest deploy log https://app.netlify.com/sites/crossplane/deploys/65403b596689fd00088f70f5
😎 Deploy Preview https://deploy-preview-583--crossplane.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance:
Accessibility:
Best Practices:
SEO:
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@negz
Copy link
Member Author

negz commented Oct 25, 2023

Here's a rough draft of the topics I think I want to cover and where:

In concepts/composition-functions.md

  • What a function is
  • Installing a Function package
  • Using functions
    • Using a function in a Composition
    • Using a pipeline of functions in a Composition
    • Test a Composition that uses functions using crossplane beta render
    • Links to interesting functions folks have built
  • Develop a function
    • How a function works (developer focused)
    • RunFunctionRequest and RunFunctionResponse overview
    • Tips and gotchas for writing a Function
    • Links to more detailed, language specific guides

In concepts/packages.md:

  • Function packages

In knowledge-base/guides/...:

  • Detailed, step-by-step guide to writing a function in Go

I think each of these Functions could use some documentation somewhere:

I'm not sure whether that should be the Marketplace or the docs site (knowledge base)?

@negz
Copy link
Member Author

negz commented Oct 27, 2023

@plumbis I'm (mostly) able to generate a Hugo-compatible page of API documentation for the types Crossplane uses to communicate with functions. See crossplane/crossplane#4914. These types are pretty deep - the SDKs will abstract them away a bit - but they're probably worth having access to for advanced function developers.

Would it make sense to include these somewhere under content? Any idea where? They're fairly coupled to a Crossplane release.

@plumbis
Copy link
Collaborator

plumbis commented Oct 27, 2023

Is this a different type of API doc than the Crossplane CRDs?

@negz
Copy link
Member Author

negz commented Oct 27, 2023

@plumbis Yeah, these docs are generated from protobuf schemas rather than CRD OpenAPI schemas. So it’s a different tool doing the generation. (See crossplane/crossplane#4914.)

Copy link
Member Author

@negz negz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plumbis @phisco this is ready for review. There's more documentation to be done, but I can handle it in separate PRs. Namely I want to:

Here's a brief example of a `FunctionIO`:
<!-- vale write-good.Passive = NO -->
Here's an example of a tiny, hello world function. This example is written in
Go.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plumbis, Vale seems to be parsing "Go." (with period) as a word and complaining that it's a spelling mistake. Any idea how to fix that? I added Go (no period) to the dictionary.


### FunctionIO
See the [Crossplane CLI docs](https://github.com/crossplane/docs/pull/584) to
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is a placeholder. Needs updating when #584 is merged.

applying any changes to the API server. Crossplane surfaces this error as a
`Warning` event, a debug log, and by setting the `Synced` status condition of
the XR to "False".
You use the [Crossplane CLI](https://github.com/crossplane/docs/pull/584) to
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is a placeholder. Needs updating when #584 is merged.

@TerjeLafton
Copy link

I haven't read very thoroughly, but this seem really nice to me!

Copy link

@JonasKs JonasKs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, thanks for this! 😊
As I said in slack, this image is hard to read when using dark mode:
image

Copy link
Collaborator

@plumbis plumbis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost done but have a bit more of the compostion-functions page to get through.

content/master/concepts/compositions.md Outdated Show resolved Hide resolved
content/master/concepts/compositions.md Outdated Show resolved Hide resolved
content/master/concepts/composition-functions.md Outdated Show resolved Hide resolved
content/master/concepts/composition-functions.md Outdated Show resolved Hide resolved
themes/geekboot/layouts/partials/single-list.html Outdated Show resolved Hide resolved
content/master/concepts/composition-functions.md Outdated Show resolved Hide resolved
content/master/concepts/composition-functions.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@plumbis plumbis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking nit. Approved!

Comment on lines +369 to +372
<!-- vale write-good.Passive = NO -->
Here's an example of a tiny, hello world function. This example is written in
[Go](https://go.dev).
<!-- vale write-good.Passive = YES -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- vale write-good.Passive = NO -->
Here's an example of a tiny, hello world function. This example is written in
[Go](https://go.dev).
<!-- vale write-good.Passive = YES -->
Here's an example of a tiny, hello world function. This example is in
[Go](https://go.dev).

@negz negz changed the base branch from master to v1.14-release October 30, 2023 23:16
@negz negz changed the base branch from v1.14-release to master October 30, 2023 23:24
plumbis and others added 17 commits October 30, 2023 16:25
This updates all current documentation of Composition Functions in the
master directory to reflect the new v1beta1 implementation.

Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
I plan to use the same page to document how to write a composition
function. I'll add that documenation in a future commit.

Signed-off-by: Nic Cope <nicc@rk0n.org>
Per instructions from Hugo:
https://gohugo.io/content-management/diagrams/#mermaid-diagrams

The styling could probably be updated to be more in line with the rest
of the docs, but this already looks better to me than the goat ASCII
diagrams Hugo supports out of the box.

Signed-off-by: Nic Cope <nicc@rk0n.org>
This consists of two sections in the existing page:

* How to write a function
* How functions work

The former is somewhat light, because I intend to add detailed guides
for each language we support. It's hard to go too deep in this general
documentation without using language-specific examples.

Signed-off-by: Nic Cope <nicc@rk0n.org>
Also sort -u the jargon file, because I'm too lazy to figure out
ordering manually. :)

Signed-off-by: Nic Cope <nicc@rk0n.org>
We might want to update these to marketplace links once they're
available.

Signed-off-by: Nic Cope <nicc@rk0n.org>
In particular, elaborate on how to test a function that is under
development.

Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
They no longer exist in v1.14

Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Signed-off-by: Nic Cope <nicc@rk0n.org>

Co-authored-by: Pete Lumbis <pete@upbound.io>
This could look better but it's a good start to make the diagrams match the light/dark theme.

There is a bug in here that switching themes doesn't update the diagram (but it works on future loads)

Signed-off-by: Nic Cope <nicc@rk0n.org>

Co-authored-by: Pete Lumbis <pete@upbound.io>
Signed-off-by: Nic Cope <nicc@rk0n.org>
Honestly mostly to workaround Vale thinking "Go." is a spelling mistake.

Signed-off-by: Nic Cope <nicc@rk0n.org>
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.

4 participants