generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 274
feat: Support custom type recursive reference #714
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
Open
AlessioDiama
wants to merge
7
commits into
kubernetes-sigs:main
Choose a base branch
from
AlessioDiama:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+368
−10
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7361d8e
feat: support custom type recursive reference
AlessioDiama f7b2bc8
implement suggestions
AlessioDiama 8a15e8e
implement other suggestions
AlessioDiama bf5f540
extractDependenciesFromMap new implementation
AlessioDiama 7b156e1
fix .gitignore
AlessioDiama ba95c11
fix .gitignore
AlessioDiama 8ee77f2
Merge branch 'main' into main
AlessioDiama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,5 @@ TODO.* | |
| node_modules/ | ||
|
|
||
| tools/lsp/client/out/ | ||
| # VSCode Debug cache files | ||
| **/__debug* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # kro recursive custom type reference example | ||
|
|
||
| This example creates a ResourceGraphDefinition called `CompanyConfig` with three custom types referencing mong each other | ||
|
|
||
| ### Create ResourceGraphDefinition called CompanyConfig | ||
|
|
||
| Apply the RGD to your cluster: | ||
|
|
||
| ``` | ||
| kubectl apply -f rg.yaml | ||
| ``` | ||
|
|
||
| Validate the RGD status is Active: | ||
|
|
||
| ``` | ||
| kubectl get rgd company.kro.run | ||
| ``` | ||
|
|
||
| Expected result: | ||
|
|
||
| ``` | ||
| NAME APIVERSION KIND STATE AGE | ||
| company.kro.run v1alpha1 CompanyConfig Active XXX | ||
| ``` | ||
|
|
||
| ### Create an Instance of kind App | ||
|
|
||
| Apply the provided instance.yaml | ||
|
|
||
| ``` | ||
| kubectl apply -f instance.yaml | ||
| ``` | ||
|
|
||
| Validate instance status: | ||
|
|
||
| ``` | ||
| kubectl get companyconfigs my-company-config | ||
| ``` | ||
|
|
||
| Expected result: | ||
|
|
||
| ``` | ||
| NAME STATE SYNCED AGE | ||
| my-company-config ACTIVE True XXX | ||
| ``` | ||
|
|
||
| ### Clean up | ||
|
|
||
| Remove the instance: | ||
|
|
||
| ``` | ||
| kubectl delete companyconfigs my-company-config | ||
| ``` | ||
|
|
||
| Remove the resourcegraphdefinition: | ||
|
|
||
| ``` | ||
| kubectl delete rgd company.kro.run | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| apiVersion: kro.run/v1alpha1 | ||
| kind: CompanyConfig | ||
| metadata: | ||
| name: my-company-config | ||
| spec: | ||
| name: my-company-cm | ||
| namespace: default | ||
| roles: | ||
| - name: CEO | ||
| seniority: Senior | ||
| aliases: | ||
| - SupremeChief | ||
| - name: CFO | ||
| seniority: Senior | ||
| aliases: | ||
| - MoneyBoss | ||
| - name: Engineer | ||
| seniority: Senior | ||
| aliases: | ||
| - Developer | ||
| - name: Intern | ||
| seniority: Junior | ||
| aliases: | ||
| - Trainee | ||
| - name: Marketer | ||
| seniority: Mid | ||
| aliases: | ||
| - Marketing Specialist | ||
| - name: Social Media Manager | ||
| seniority: Mid | ||
| aliases: | ||
| - Social Media Specialist | ||
| management: | ||
| - name: Mario | ||
| role: | ||
| name: CEO | ||
| seniority: Senior | ||
| colleagues: | ||
| luigi: | ||
| name: Secretary | ||
| seniority: Mid | ||
| - name: Luigi | ||
| role: | ||
| name: CFO | ||
| seniority: Senior | ||
| colleagues: | ||
| viktor: | ||
| name: Assistant | ||
| seniority: Mid | ||
| divisions: | ||
| - name: Engineering | ||
| employees: | ||
| - name: Peach | ||
| role: | ||
| name: Engineer | ||
| seniority: Senior | ||
| colleagues: | ||
| daisy: | ||
| name: Engineer | ||
| seniority: Mid | ||
| aliases: [DevOps] | ||
| - name: Toad | ||
| role: | ||
| name: Intern | ||
| seniority: Junior | ||
| colleagues: | ||
| tony: | ||
| name: Intern | ||
| seniority: Junior | ||
| - name: Marketing | ||
| employees: | ||
| - name: Yoshi | ||
| role: | ||
| name: Marketer | ||
| seniority: Mid | ||
| - name: Donkey Kong | ||
| role: | ||
| name: Social Media Manager | ||
| seniority: Mid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| apiVersion: kro.run/v1alpha1 | ||
| kind: ResourceGraphDefinition | ||
| metadata: | ||
| name: company.kro.run | ||
| spec: | ||
| schema: | ||
| types: | ||
| Person: | ||
| name: string | ||
| role: "Role" | ||
| colleagues: "map[string]Role" | ||
| address: | ||
| street: string | ||
| city: string | ||
| state: string | ||
| zip: string | ||
| Division: | ||
| name: string | ||
| employees: "[]Person" | ||
| Role: | ||
| name: string | ||
| seniority: string | ||
| aliases: "[]string" | ||
| spec: | ||
| name: string | ||
| namespace: string | default=default | ||
| management: "[]Person" | ||
| divisions: "[]Division" | ||
| roles: "[]Role" | ||
| apiVersion: v1alpha1 | ||
| kind: CompanyConfig | ||
| resources: | ||
| - id: configmap | ||
| template: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: ${schema.spec.name} | ||
| namespace: ${schema.spec.namespace} | ||
| labels: | ||
| app.kubernetes.io/name: ${schema.spec.name} | ||
| data: | ||
| management: | | ||
| ${schema.spec.management.map(e, e.name + " (" + e.role.name + ")").join(", ")} | ||
| divisions: | | ||
| ${schema.spec.divisions.map(d, d.name + ": " + d.employees.map(e, e.name).join(", ")).join("\n")} | ||
| # roles: | | ||
| # ${schema.spec.roles.map(r, r.name + " (" + r.seniority.join(", ") + ")").join(", ")} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: