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

Intro to open source with knative blog series p3 #5949

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Leo6Leo
Copy link
Member

@Leo6Leo Leo6Leo commented Apr 25, 2024

This PR contains a draft of the first post in the blog series we proposed recently to make it easier for new contributors to contribute code. The proposal can be seen here

Proposed Changes

  • Create post 3: API Changes

Copy link

knative-prow bot commented Apr 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Leo6Leo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 25, 2024
@knative-prow knative-prow bot requested review from nainaz and skonto April 25, 2024 13:09
Copy link

netlify bot commented Apr 25, 2024

Deploy Preview for knative ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 95063ce
🔍 Latest deploy log https://app.netlify.com/sites/knative/deploys/66437a9dd9950700087f12bd
😎 Deploy Preview https://deploy-preview-5949--knative.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@Leo6Leo
Copy link
Member Author

Leo6Leo commented Apr 25, 2024

/cc @Cali0707 @pierDipi @creydr

@Leo6Leo Leo6Leo requested a review from Cali0707 April 25, 2024 13:38
Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

Nice start @Leo6Leo !

Just a couple changes needed for clarity/better rendering and then we should be good to go here!

blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
Now that we know what APIs are (generally, and in the context of Knative), we are ready to explore how we can make changes to them. When we want to update an API there are two, maybe three steps that you need to take.
Update the struct for the object. In our case, we want to update the SampleSource struct. In Knative, these are often found in pkg/apis/<groupname>/<version>/<resourcename>_types.go. Looking at this struct, we can see that there is a structure to it that all resources generally follow:

![](/blog/images/getting-started-blog-series/post3/005.png)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way to make this image shorter? It is VERY large on the rendered site

Copy link
Member

Choose a reason for hiding this comment

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

Also, we should give some kind of context to this image in the text. It feels very out of place when reading - you are expecting to see a block of code, and then for some reason you see a large image of a file directory, and it is unclear what the relation is of this image to the code block below

Copy link
Member Author

Choose a reason for hiding this comment

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

The picture here is to showcase mentioned above.

these are often found in pkg/apis///_types.go.

What I could try to do is cut the image and only show the file name part, and use markdown to limit the image size, and that should make it more clear and nice looking on the rendered website.
image

WDYT? @Cali0707

Copy link
Member

Choose a reason for hiding this comment

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

Whatever you think is best, maybe we could also not use an image but just mention the file path in the actual text? I don't feel like this image is currently providing a lot of value

blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
blog/docs/articles/getting-started-blog-p3.md Outdated Show resolved Hide resolved
## How can we change an API?

![](/blog/images/getting-started-blog-series/post3/004.png)
Now that we know what APIs are (generally, and in the context of Knative), we are ready to explore how we can make changes to them. When we want to update an API there are two, maybe three steps that you need to take.
Copy link
Contributor

Choose a reason for hiding this comment

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

make it either 2 steps or 3 steps and not both. Let's remove the ambiguity. :)


![](/blog/images/getting-started-blog-series/post3/004.png)
Now that we know what APIs are (generally, and in the context of Knative), we are ready to explore how we can make changes to them. When we want to update an API there are two, maybe three steps that you need to take.
Update the struct for the object. In our case, we want to update the SampleSource struct. In Knative, these are often found in `pkg/apis/<groupname>/<version>/<resourcename>_types.go`. Looking at this struct, we can see that there is a structure to it that all resources generally follow:
Copy link
Contributor

Choose a reason for hiding this comment

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

While reading it seems Update the struct is the first step. I would start this as a new para and also it is hard to follow where one step ended and second began.


```

All we added was the MessageTemplate string to the spec. Note the JSON tag - this is very important! Without a JSON tag, this field will not be read out of a JSON object when the controller receives info about it from the API Server, and the value will not be written to the JSON we send back to the API Server, so it would not be stored in etcd.
Copy link
Contributor

Choose a reason for hiding this comment

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

this spec should Spec.

@nainaz
Copy link
Contributor

nainaz commented May 15, 2024

Great start and left some comments.
Maybe that was the intention of the blog post but to me it felt that it ended abruptly. I didn't "see" any result or output.
I just changed a file, got suggestion to change the other file but then to what end.

@Cali0707
Copy link
Member

Maybe that was the intention of the blog post but to me it felt that it ended abruptly. I didn't "see" any result or output.

@nainaz that's a great point, we should probably improve the conclusion a bit

The idea is that readers would then continue to the future blog posts we are working on and make the rest of the required changes there. But, I can see how that could be unclear or leave someone unsatisfied reading the current post.

@nainaz
Copy link
Contributor

nainaz commented May 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants