-
Notifications
You must be signed in to change notification settings - Fork 30
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
Adding Helm-To-Operator-Codegen-Sdk Documentation #117
Conversation
✅ Deploy Preview for nephio ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/retest |
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.
Initial review
@@ -16,6 +16,7 @@ for deploying on Kubernetes, legacy helm support will be required for a number o | |||
|
|||
### Deployment options | |||
|
|||
* [Using Helm To Operator Codegen Sdk](/docs/guides/user-guides/helm/helm-to-operator-codegen-sdk-user-guide.md) |
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 that relative paths can work here
* [Using Helm To Operator Codegen Sdk](/docs/guides/user-guides/helm/helm-to-operator-codegen-sdk-user-guide.md) | |
* [Using Helm To Operator Codegen Sdk](helm-to-operator-codegen-sdk-user-guide.md) |
The [Helm to Operator Codegen SDK](https://github.com/nephio-project/nephio-sdk/tree/main/helm-to-operator-codegen-sdk) offers a streamlined solution for translating existing Helm charts into Kubernetes operators with minimal effort and cost. | ||
|
||
## The Flow Diagram | ||
In a nutshell, Firstly, the Helm-Charts are converted to Yamls using the values provided in "values.yaml". Then, each Kubernetes Resource Manifest (KRM) in the YAML is translated into Go code, employing one of two methods. |
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.
In a nutshell, Firstly, the Helm-Charts are converted to Yamls using the values provided in "values.yaml". Then, each Kubernetes Resource Manifest (KRM) in the YAML is translated into Go code, employing one of two methods. | |
In a nutshell, the Helm-Charts are converted to YAML files using the values provided in "values.yaml". Then, each Kubernetes Resource Model (KRM) in the YAML is translated into Go code, employing one of two methods. |
1) If the resource is Runtime-Supported, it undergoes a conversion process where the KRM resource is first transformed into a Runtime Object, then into JSON, and finally into Go code. | ||
2) Otherwise, if the resource is not Runtime-Supported, it is converted into an Unstructured Object and then into Go code. | ||
|
||
After the conversion process, all the generated Go code is gathered and compiled into a single Go file. This resulting file contains functions that can be readily utilized by Kubernetes operators. |
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.
After the conversion process, all the generated Go code is gathered and compiled into a single Go file. This resulting file contains functions that can be readily utilized by Kubernetes operators. | |
After the conversion process, all the generated Go code is gathered and compiled into a single Go file. This process results in a file that contains functions which can be readily utilized by Kubernetes operators. |
### Flow-1: Helm to Yaml | ||
Helm to Yaml conversion is achieved by running the command |
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.
### Flow-1: Helm to Yaml | |
Helm to Yaml conversion is achieved by running the command | |
### Flow-1: Helm to YAML | |
Helm to YAML conversion is achieved by running the following command |
----- | ||
### Flow-1: Helm to Yaml | ||
Helm to Yaml conversion is achieved by running the command | ||
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, It retrieves the values from default "values.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.
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, It retrieves the values from default "values.yaml" | |
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, it retrieves the values from default "values.yaml" |
Helm to Yaml conversion is achieved by running the command | ||
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, It retrieves the values from default "values.yaml" | ||
|
||
### Flow-2: Yaml Split |
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.
### Flow-2: Yaml Split | |
### Flow-2: YAML Split |
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, It retrieves the values from default "values.yaml" | ||
|
||
### Flow-2: Yaml Split | ||
The SDK iterates over each YAML file in the "converted-yamls" directory. If a YAML file contains multiple Kubernetes Resource Manifests (KRM), separated by "---", the SDK splits the YAML file accordingly to isolate each individual KRM resource. This ensures that each KRM resource is processed independently. |
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.
The SDK iterates over each YAML file in the "converted-yamls" directory. If a YAML file contains multiple Kubernetes Resource Manifests (KRM), separated by "---", the SDK splits the YAML file accordingly to isolate each individual KRM resource. This ensures that each KRM resource is processed independently. | |
The SDK iterates over each YAML file in the "converted-yamls" directory. If a YAML file contains multiple Kubernetes Resource Models (KRMs), separated by "---", the SDK splits the YAML file accordingly to isolate each individual KRM resource. This ensures that each KRM resource is processed independently. |
1. GoLang Version: 1.21 | ||
2. Helm : v3.9.3 | ||
3. Kubebuilder | ||
4. A Kubernetes Cluster with Calico CNI and multus-cni plugin (Can Refer [here](https://medium.com/rahasak/deploying-5g-core-network-with-free5gc-kubernets-and-helm-charts-29741cea3922), Before "Deploy Helm-Chart Part" ) |
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 when using free5gc I always found it easier to work with Flannel for this reason
ipv4.ip_forward We remind you that some CNI plugins (e.g. Flannel) allow this functionality by default, while others (.e.g. Calico) require a special 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.
Yes, I recall, there were some additional configurations while working with Calico CNI , but thanks for the info about Flannel, I will surely check it out!!
I think the Check links job is failing because the user guide is not in the _index.md.
|
|
||
### Flow-3.2: Runtime-Object to JSON | ||
Firstly, the SDK performs a typecast of the runtime object to its actual data type. For instance, if the Kubernetes Kind is "Service," the SDK typecasts the runtime object to the specific data type corev1.Service. Then, it conducts a Depth-First Search (DFS) traversal over the corev1.Service object using reflection. During this traversal, the SDK generates a JSON structure that encapsulates information about the struct hierarchy, including corresponding data types and values. This transformation results in a JSON representation of the corev1.Service object's structure and content. | ||
<details> |
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 would use the <details>
tag here, It makes the content collapsed by default, so people will just not recognise it. Is this something what is not important?
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 am sorry but I didn't understand, you mean to say that you wouldn't use the details tag, right?
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.
Yes, exactly :)
### Flow-3.3: JSON to String (Go-Code) | ||
The SDK reads the JSON file containing the information about the Kubernetes resource and then translates this information into a string of Go code. This process involves parsing the JSON structure and generating corresponding Go code strings based on the structure, data types, and values extracted from the JSON representation. Ultimately, this results in a string that represents the Kubernetes resource in a format compatible with Go code. | ||
|
||
<details> |
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 this should be simply just normal description.
<summary>TraverseJSON Cases (Json-to-String)</summary> | ||
|
||
|
||
``` |
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.
Why is this intro text is added as a code example?
|
||
The Config-Jsons are required for more package-specific-types (such as : v1.Service, v1.Deployment) | ||
|
||
#### i) Struct_Module_mapping.json |
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) Struct_Module_mapping.json | |
#### Struct_Module_mapping.json |
v1.Service --> corev1.Service | ||
``` | ||
|
||
#### ii) Enum_Module_mapping.json |
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.
#### ii) Enum_Module_mapping.json | |
#### Enum_Module_mapping.json |
### Flow-4: KRM to Unstruct-Obj to String(Go-code) | ||
All Kubernetes resource kinds that are not supported by the runtime-object method are handled using the unstructured method. In this approach, the Kubernetes Resource MOdel (KRM) is converted to an unstructured object using the package "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured". | ||
Then, We traverse the unstructured-Obj in a DFS fashion and build the gocode-string. | ||
<details> |
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 would leave the <details>
<summary>DFS Algorithm Cases (Unstruct-Version)</summary> | ||
|
||
|
||
``` |
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.
All of this is normal description and not example code.
@@ -0,0 +1,333 @@ | |||
--- | |||
title: Helm to Operator Codegen Sdk Developer Guide |
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.
Is this a document for the developers of Helm to Operator Codegen Sdk?
If yes, then it should be moved to the Nephio contributor guides section.
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.
Yes, it is intended for developers, I will surely move it to "Nephio contributor guides section."
<details> | ||
<summary>The output is similar to:</summary> | ||
|
||
```console |
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.
```console | |
```bash |
<details> | ||
<summary>The output Should be: </summary> | ||
|
||
``` |
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.
``` | |
```bash |
/retest |
Hi @CsatariGergely , can you help me resolve the "broken-links" issue/ "linkspector job failing".
|
Hi, I think it is "just" a flaky run. Someone with elevated rights could re-run the failed jobs. This change will fix the error. |
content/en/docs/guides/user-guides/helm/helm-to-operator-codegen-sdk-user-guide.md
Outdated
Show resolved
Hide resolved
/retest does not re-run the link check job. Maybe we can add some config to prow bot to do that? |
@CsatariGergely: The
Use
In response to this:
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/test-infra repository. |
Co-authored-by: Gergely Csatari <[email protected]>
So, any more comments anyone? |
@efiacor @lapentad @CsatariGergely @electrocucaracha @liamfallon @tliron ,If there are not further comments, Can we merge this PR? |
----- | ||
### Flow-1: Helm to YAML | ||
Helm to YAML conversion is achieved by running the following command | ||
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, it retrieves the values from default "values.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.
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` Internally. As of now, it retrieves the values from default "values.yaml" | |
`helm template <chart> --namespace <namespace> --output-dir “temp/templated/”` internally. As of now, it retrieves the values from default "values.yaml" |
|
||
By utilizing the Helm to Operator Codegen SDK, users can efficiently convert existing Helm charts into Kubernetes operators. This transition enables users to leverage the advanced capabilities provided by Kubernetes operators, such as enhanced automation, lifecycle management, and custom logic handling. Overall, the SDK facilitates a smooth migration process, empowering users to embrace the operator model for managing their Kubernetes resources effectively. | ||
|
||
## Excercise: Deploying Free5gc using operator |
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.
## Excercise: Deploying Free5gc using operator | |
## Exercise: Deploying Free5gc using operator |
@efiacor @lapentad @CsatariGergely @electrocucaracha @liamfallon @tliron , any further comments? |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liamfallon 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 |
/lgtm |
The current pr contains the user-guide as well as developer-guide for helm-to-operator-codegen-sdk which is a part of nephio sdk (https://github.com/nephio-project/nephio-sdk)