-
Notifications
You must be signed in to change notification settings - Fork 136
Add Metal3 Custom Resources Documentation #559
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi @pratik-mahalle. Thanks for your PR. I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
lentzi90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I have gone through it and added comments below. Unfortunately it feels quite AI generated with redundant information, useless links to the front page and confident "best practices" out of nowhere. There is still a lot of good here, but you will need to work on it before we merge.
This was supposed to be a pretty straight forward task, just copy and paste from the links in the issue description and clean it up. Now it is both harder to review (because it is hard to compare with the old docs) and more work to clean it up because of all the extra stuff that I assume came with the AI.
| ## Key Concepts | ||
|
|
||
| ### Data Templates and Instances | ||
|
|
||
| CAPM3 uses a template-based approach for generating host-specific configuration | ||
| data: | ||
|
|
||
| 1. **Metal3DataTemplate**: Contains templates for metadata and network | ||
| configuration that will be rendered for each host | ||
| 2. **Metal3Data**: Represents the actual rendered data for a specific host, | ||
| created from a template | ||
|
|
||
| ### Metadata and Network Data | ||
|
|
||
| - **Metadata**: Contains host-specific information like hostnames, labels, and | ||
| custom key-value pairs | ||
| - **Network Data**: Defines the network configuration including interfaces, IP | ||
| addresses, routes, and DNS settings | ||
|
|
||
| ### Index Management | ||
|
|
||
| CAPM3 automatically manages indexes for hosts to ensure unique identification and | ||
| proper resource allocation. Each Metal3Data instance gets a unique index that is | ||
| used in naming and resource allocation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels redundant to me (everything from key concepts). Some of this is already in the overview and the details are better covered on the separate pages.
| resource | ||
| - [Metal3DataTemplate](metal3datatemplate.md) - Detailed documentation for the | ||
| Metal3DataTemplate resource | ||
| - [Cluster API Documentation](https://cluster-api.sigs.k8s.io/) - General |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can leave this out. It is not really relevant here, and we are so deep in the docs that any user getting here should already have come across CAPI.
| - [Metal3Machine](../introduction.md) - Machine management | ||
| - [BareMetalHost](../bmo/introduction.md) - Host provisioning | ||
| - [IP Address Manager](../ipam/introduction.md) - IP pool management |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete these. The Metal3Machine link just goes to the front page... BareMetalHost goes to BMO intro...
| ## Error Handling | ||
|
|
||
| ### Common Error Scenarios | ||
|
|
||
| 1. **Template Not Found**: The referenced `Metal3DataTemplate` doesn't exist | ||
| 2. **Index Conflicts**: Multiple controllers try to use the same index | ||
| 3. **Secret Creation Failure**: Unable to create the required secrets | ||
| 4. **Template Rendering Errors**: Invalid template configuration | ||
|
|
||
| ### Error Status | ||
|
|
||
| When errors occur, the status fields are updated: | ||
|
|
||
| ```yaml | ||
| status: | ||
| ready: false | ||
| error: true | ||
| errorMessage: "Failed to create metadata secret: template validation failed" | ||
| ``` | ||
|
|
||
| ## Best Practices | ||
|
|
||
| 1. **Monitor Status**: Check the `ready` and `error` status fields | ||
| 2. **Handle Errors**: Implement proper error handling for failed data | ||
| generation | ||
| 3. **Use Indexing**: Leverage the automatic indexing for consistent naming | ||
| 4. **Template Validation**: Validate templates before deployment | ||
| 5. **Secret Management**: Ensure proper RBAC for secret access | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| **Issue**: Metal3Data stuck in "not ready" state | ||
|
|
||
| - **Check**: Template configuration and validation | ||
| - **Solution**: Verify template syntax and referenced resources | ||
|
|
||
| **Issue**: Index conflicts | ||
|
|
||
| - **Check**: Existing Metal3Data objects and their indexes | ||
| - **Solution**: Clean up orphaned objects or adjust indexing strategy | ||
|
|
||
| **Issue**: Secret creation failures | ||
|
|
||
| - **Check**: RBAC permissions and namespace access | ||
| - **Solution**: Ensure proper permissions for secret creation | ||
|
|
||
| ### Debugging Commands | ||
|
|
||
| ```bash | ||
| # Check Metal3Data status | ||
| kubectl get metal3data -n <namespace> | ||
| # View Metal3Data details | ||
| kubectl describe metal3data <name> -n <namespace> | ||
| # Check generated secrets | ||
| kubectl get secrets -n <namespace> | grep <machine-name> | ||
| # View secret content | ||
| kubectl get secret <secret-name> -n <namespace> -o yaml | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this (from Error handling). This does not seem useful to me and it should anyway not be on this page. We have a separate troubleshooting page where it may fit. But even then, we should not include things like index conflicts... that is handled by the controllers and not something users should have to think about.
| errorMessage: "<error-message>" | ||
| ``` | ||
| ## Lifecycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is missing an important thing:
If the Metal3DataTemplate object is updated, the generated secrets will not be updated, to allow for reprovisioning of the nodes in the exact same state as they were initially provisioned. Hence, to do an update, it is necessary to do a rolling upgrade of all nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not addressed either?
| ## Best Practices | ||
|
|
||
| 1. **Use Template References**: Always set `templateReference` for better | ||
| template management | ||
| 2. **Plan Indexing**: Consider your indexing strategy for consistent naming | ||
| 3. **Validate Network Config**: Test network configurations before deployment | ||
| 4. **Use IP Pools**: Leverage IP pools for dynamic address allocation | ||
| 5. **Document Templates**: Keep templates well-documented for team | ||
| collaboration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this section. Especially the template reference is going to be removed and should not be used.
| - [Metal3Data](metal3data.md) - The rendered data instances | ||
| - [IP Address Manager](https://github.com/metal3-io/ip-address-manager) - IP pool | ||
| management | ||
| - [Nova Network Data Format](https://docs.openstack.org/nova/latest/) - Network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same link as earlier or remove it.
| ## Template Reference Management | ||
|
|
||
| The `templateReference` field enables template versioning and updates: | ||
|
|
||
| - **Immutable Templates**: Data template parts are immutable since BareMetalHost | ||
| references the secrets | ||
| - **Update Process**: Updates require creating a new template and referencing it | ||
| in the Metal3MachineTemplate | ||
| - **Backward Compatibility**: Supports transition from old templates without | ||
| `templateReference` to new ones | ||
|
|
||
| ### Template Linking | ||
|
|
||
| Metal3Data objects are linked to Metal3DataTemplate by: | ||
|
|
||
| 1. Direct reference in the `template` field | ||
| 2. Matching `templateReference` key | ||
| 3. Template's `templateReference` matching the Metal3Data's template name | ||
| (backward compatibility) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest removing everything about template references as we are going to remove that field soon anyway.
| - `fromAnnotation`: MAC from object annotation | ||
| - `fromHostInterface`: MAC from BareMetalHost interface | ||
|
|
||
| ### Networks Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section could benefit from some sub-sections like Bond Modes and Ethernet Types above. For example the fields under networks and routes
|
/retitle Add Metal3 Custom Resources Documentation |
|
Hey @lentzi90, I have updated and improve it. Please let me know if anything needs to revise or check |
lentzi90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, it looks better!
I still have a few comments below. Could you also check the test failures?
We are using a markdown linter that requires a specific format for some things. For example it is complaining if code blocks or titles are not surrounded by blank lines.
| ## Template Reference Management | ||
|
|
||
| The `templateReference` field enables linking to specific template versions: | ||
|
|
||
| - **Backward Compatibility**: If not set, the controller matches by template | ||
| name | ||
| - **Version Control**: When set, enables template versioning and updates | ||
| - **Transition Support**: Allows migration from old templates to new ones |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this.
| kind: Metal3DataTemplate | ||
| name: worker-template | ||
| spec: | ||
| templateReference: worker-v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| templateReference: worker-v1 |
| ## Template Update Behavior | ||
| **Important**: If the `Metal3DataTemplate` object is updated, the generated | ||
| secrets will not be updated automatically. This behavior is intentional to | ||
| allow for reprovisioning of the nodes in the exact same state as they were | ||
| initially provisioned. | ||
|
|
||
| To apply template updates to existing nodes, it is necessary to perform a | ||
| rolling upgrade of all nodes that reference the updated template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this down and make it a subsection under "Lifecycle"?
| ## Key Concepts | ||
|
|
||
| ### Data Templates and Instances | ||
|
|
||
| CAPM3 uses a template-based approach for generating host-specific configuration | ||
| data: | ||
|
|
||
| 1. **Metal3DataTemplate**: Contains templates for metadata and network | ||
| configuration that will be rendered for each host | ||
| 2. **Metal3Data**: Represents the actual rendered data for a specific host, | ||
| created from a template | ||
|
|
||
| ### Metadata and Network Data | ||
|
|
||
| - **Metadata**: Contains host-specific information like hostnames, labels, and | ||
| custom key-value pairs | ||
| - **Network Data**: Defines the network configuration including interfaces, IP | ||
| addresses, routes, and DNS settings | ||
|
|
||
| ### Index Management | ||
|
|
||
| CAPM3 automatically manages indexes for hosts to ensure unique identification and | ||
| proper resource allocation. Each Metal3Data instance gets a unique index that is | ||
| used in naming and resource allocation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Key Concepts | |
| ### Data Templates and Instances | |
| CAPM3 uses a template-based approach for generating host-specific configuration | |
| data: | |
| 1. **Metal3DataTemplate**: Contains templates for metadata and network | |
| configuration that will be rendered for each host | |
| 2. **Metal3Data**: Represents the actual rendered data for a specific host, | |
| created from a template | |
| ### Metadata and Network Data | |
| - **Metadata**: Contains host-specific information like hostnames, labels, and | |
| custom key-value pairs | |
| - **Network Data**: Defines the network configuration including interfaces, IP | |
| addresses, routes, and DNS settings | |
| ### Index Management | |
| CAPM3 automatically manages indexes for hosts to ensure unique identification and | |
| proper resource allocation. Each Metal3Data instance gets a unique index that is | |
| used in naming and resource allocation. |
|
Hey @lentzi90, I have updated the changes you suggest. Please have a look at it when you got time |
lentzi90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think this is good enough to merge now.
Could you squash the commits? Then I am happy to approve
137982a to
aba03ce
Compare
Hey @lentzi90 I have squash the commit, Please go ahead |
|
One more thing. Could you include some more details in the commit description? It would also be nice to update the PR description. It still includes things like best practices and what tests have been done (which is quite irrelevant since the automated tests run on the PR). Could you instead please link to the issue (#398) you are fixing? |
|
Hey @lentzi90, please check. I have updated that |
lentzi90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/approve
| kind: KubeadmControlPlane | ||
| name: test1 | ||
| namespace: metal3 | ||
| ```` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is four ticks, breaks formatting.
| The `Cluster` resource is **CAPI resource** and includes a reference to the control | ||
| plane via the `controlPlaneRef` field: | ||
|
|
||
| ``` yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ``` yaml | |
| ```yaml |
No spaces
| an infrastructure provider for cluster API (CAPI), it necessarily references | ||
| also other CAPI resources, however, this document focuses on metal3 resources. | ||
|
|
||
| For more details about CAPI resources and to get a big picture, refer to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| For more details about CAPI resources and to get a big picture, refer to | |
| For more details about CAPI resources and to get the big picture, refer to |
| 1. Create a Metal3DataTemplate with your desired metadata and network | ||
| configuration | ||
| 2. Reference the template in your Metal3MachineTemplate | ||
| 3. CAPM3 automatically creates Metal3Data instances and renders the | ||
| configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use backticks around CRD names like elsewhere in this PR for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any backticks?
|
|
||
| ### Advanced Usage | ||
|
|
||
| - Use IP pools for dynamic IP address allocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specific resource names mentioned here, preferably with links, would go long way for user friendly documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still open.
tuminoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for putting in the work. Some feedback:
- Can you please fix all of the misspellings of
metal3toMetal3, alsocluster APItoCluster APIetc - These new files besides data_sources.md are not linked from anywhere, how is user supposed to find them in user-guide?
- Let's not use backticks in titles. It is not enforced but it is not good practice
- Maybe leave out the design doc URL fix into separate PR as it requires different set of approvers than the rest and is not related to CRD documenation
- Some comments left here and there
With some polishing this will make nice addition to our user guide.
/cc @elfosardo @dtantsur
for some more eyes
Hey @tuminoid, need to clarify some thing. And also -Maybe leave out the design doc URL fix into separate PR as it requires different set of approvers than the rest and is not related to CRD documenation |
These new documentation should be linked somewhere in the main menu, or linked from related existing documentation, so the user's can reach them.
Remove that part from this PR, and open a separate PR for the URL fix. |
|
Hey @tuminoid, As you mentioned, I have updated things. Please let me know if there is any changes. |
|
/Cc @lentzi90 |
tuminoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some open comments left.
Also, squash the commits when done fixing them up.
| Visualization of relationships between metal3 resources can be found for example | ||
| [here](https://github.com/metal3-io/cluster-api-provider-metal3/issues/1358). | ||
| Visualization of relationships between Metal3 resources can be found for example | ||
| [cluster provider Metal3](https://github.com/metal3-io/cluster-api-provider-metal3/issues/1358). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [cluster provider Metal3](https://github.com/metal3-io/cluster-api-provider-metal3/issues/1358). | |
| in this [CAPM3 isssue](https://github.com/metal3-io/cluster-api-provider-metal3/issues/1358). |
| 1. Create a Metal3DataTemplate with your desired metadata and network | ||
| configuration | ||
| 2. Reference the template in your Metal3MachineTemplate | ||
| 3. CAPM3 automatically creates Metal3Data instances and renders the | ||
| configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any backticks?
|
|
||
| ### Advanced Usage | ||
|
|
||
| - Use IP pools for dynamic IP address allocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still open.
| errorMessage: "<error-message>" | ||
| ``` | ||
| ## Lifecycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not addressed either?
I don't see updates on the PR after these comments, so they're still open on your side. |
|
I don't see much progress here. Are you still working on this? |
|
Hey @lentzi90, sorry for the delay, I will update the pr and squash the commit |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@pratik-mahalle: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Add Metal3 Custom Resources Documentation
Summary
This PR adds comprehensive documentation for Metal3 custom resources in the CAPM3 (Cluster API Provider Metal3) user guide. The documentation covers three key custom resources essential for managing bare metal infrastructure in Kubernetes clusters.
Changes Made
New Documentation Files Added
custom_resources.md- Overview and introduction to Metal3 custom resourcesmetal3data.md- Documentation for the Metal3Data resourcemetal3datatemplate.md- Comprehensive guide for Metal3DataTemplate resourceUpdated Files
SUMMARY.md- Added navigation links for the new documentation sectionsDocumentation Coverage
Metal3DataTemplate
Metal3Data
Custom Resources Overview
Benefits
Related Issue:
Fixes #398