Skip to content

docs: dependent resources #1026

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

Merged
merged 13 commits into from
Mar 22, 2022
Merged

docs: dependent resources #1026

merged 13 commits into from
Mar 22, 2022

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Mar 11, 2022

for just created branch and a skeleton (well a very skinny one), to start on the docs for dependent resources.
Will continue expanding this.

@csviri
Copy link
Collaborator Author

csviri commented Mar 11, 2022

will take a look on this failing integration test in a separate PR

Comment on lines 28 to 34
A -- Yes --> match
A -- No --> compute

compute[Compute desired state based on primary state] --> Create --> Done
match{Matches desired state as defined by primary?}
match -- Yes --> Done
match -- No --> Update
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
A -- Yes --> match
A -- No --> compute
compute[Compute desired state based on primary state] --> Create --> Done
match{Matches desired state as defined by primary?}
match -- Yes --> Done
match -- No --> Update
A -- Yes --> match
A -- No --> Create --> Done
match{Matches desired state as defined by primary?}
match -- Yes --> Done
match -- No --> Update --> Done

Desired state is computed if both cases, why are you making the difference ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No it's not actually. In the update case, the full desired state is only computed if the matcher didn't do it as it's often possible to check if the secondary resources match without computing the full desired state.

Copy link
Contributor

Choose a reason for hiding this comment

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

No it's not actually. In the update case, the full desired state is only computed if the matcher didn't do it as it's often possible to check if the secondary resources match without computing the full desired state.

Yes but to do Create or Update, you need to have a desired state in both case.
If the flow shows when the creatable desired state is computed, it should show when it is computed for Update branch.

Update is slightly more complex due to Matcher computed result can optionally provide a desired state. I thought it would make the whole picture a bit too detailed for an introduction.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's part of the subtleties of getting the management of dependents right… 😉
But, indeed, it's probably too detailed for documentation purposes.

Controllers that deal with secondary resources typically need to perform the following steps, for
each secondary resource:

```mermaid
Copy link
Collaborator Author

@csviri csviri Mar 21, 2022

Choose a reason for hiding this comment

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

I'm pretty sure Mermaid will not work with Jekyll out of the box.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes but we should be able to make it work by importing the JS lib. See https://codewithhugo.com/mermaid-js-hugo-shortcode/ for example.

Copy link
Collaborator Author

@csviri csviri Mar 21, 2022

Choose a reason for hiding this comment

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

Great, that would be awesome. Can try to take a look on that if you want.

@csviri csviri force-pushed the docs-dependent-resources branch from 0b5043d to 8e89c61 Compare March 21, 2022 07:56
@@ -0,0 +1,115 @@
---
title: Dependent Resources Feature description: Dependent Resources Feature layout: docs permalink:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunatelly formatter usually brokes this header of the file, just make sure that after format this part is reverted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yes, I did it several times while writing the docs but I guess I need to deactivate automatic formatting on commits in my IDE.


### `DependentResource` vs. `AbstractDependentResource`

The new `DependentResource` interface lies at the core of the design and strives to encapsulate the
Copy link
Collaborator Author

@csviri csviri Mar 21, 2022

Choose a reason for hiding this comment

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

Would add links here to the code when referencing specific classes.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 64 Code Smells

40.1% 40.1% Coverage
0.3% 0.3% Duplication

@csviri csviri force-pushed the docs-dependent-resources branch from 8728633 to 9453108 Compare March 21, 2022 15:38
@metacosm metacosm marked this pull request as ready for review March 22, 2022 10:27
@metacosm
Copy link
Collaborator

Let's merge this and open subsequent PRs for more improvements.

@metacosm metacosm merged commit 76650a5 into next Mar 22, 2022
@metacosm metacosm deleted the docs-dependent-resources branch March 22, 2022 11:40
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.

3 participants