Skip to content

Commit 15f0764

Browse files
feat(sample): Add private parameter (#81)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b1b934d commit 15f0764

File tree

13 files changed

+1443
-1352
lines changed

13 files changed

+1443
-1352
lines changed

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": ".NET in Codespaces",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
6+
"ghcr.io/devcontainers/features/powershell:1": {},
7+
"ghcr.io/devcontainers/features/common-utils:2": {},
8+
"ghcr.io/devcontainers/features/dotnet:2": "latest",
9+
"ghcr.io/devcontainers/features/git-lfs:1": {}
10+
},
11+
"customizations": {
12+
"vscode": {
13+
"extensions": [
14+
"GitHub.copilot",
15+
"GitHub.vscode-github-actions",
16+
"ms-dotnettools.csdevkit",
17+
"redhat.vscode-yaml"
18+
]
19+
}
20+
},
21+
"forwardPorts": [
22+
],
23+
"postCreateCommand": "dotnet restore && curl -sL \"https://raw.githubusercontent.com/crossplane/crossplane/main/install.sh\" | sh && sudo mv crossplane /usr/local/bin",
24+
"hostRequirements": {
25+
"memory": "8gb",
26+
"cpus": 4
27+
},
28+
"remoteEnv": {
29+
"DOTNET_MULTILEVEL_LOOKUP": "0",
30+
"TARGET": "net9.0"
31+
},
32+
"portsAttributes": {
33+
},
34+
"remoteUser": "root"
35+
}

.vscode/tasks.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"command": "dotnet",
77
"type": "process",
88
"args": [
9-
"build",
10-
"/consoleloggerparameters:NoSummary"
9+
"build",
10+
"/consoleloggerparameters:NoSummary"
1111
],
1212
"problemMatcher": "$msCompile"
1313
},
@@ -16,10 +16,10 @@
1616
"command": "crossplane",
1717
"type": "process",
1818
"args": [
19-
"render",
20-
"example/xr.yaml",
21-
"example/composition.yaml",
22-
"example/functions.yaml"
19+
"render",
20+
"example/xr.yaml",
21+
"example/composition.yaml",
22+
"example/functions.yaml"
2323
],
2424
"problemMatcher": "$msCompile"
2525
}

docs/Diagrams.drawio

Lines changed: 80 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,80 @@
1-
<mxfile host="Electron" modified="2024-08-12T17:10:21.646Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.0.4 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="bkYpQjrbfxJ2xywG6-4O" version="24.0.4" type="device">
2-
<diagram name="Page-1" id="ecw9FoG95bQOw1s2NnbU">
3-
<mxGraphModel dx="1430" dy="825" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0">
4-
<root>
5-
<mxCell id="0" />
6-
<mxCell id="1" parent="0" />
7-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-1" target="OzNWH8DGC0_GQPN6JCz_-13" edge="1">
8-
<mxGeometry relative="1" as="geometry" />
9-
</mxCell>
10-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-35" value="Triggers one or more" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-25" vertex="1" connectable="0">
11-
<mxGeometry x="-0.0667" y="-2" relative="1" as="geometry">
12-
<mxPoint as="offset" />
13-
</mxGeometry>
14-
</mxCell>
15-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-1" value="&lt;b&gt;Composition&lt;/b&gt;&lt;div&gt;A template to define how to create resources.&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
16-
<mxGeometry x="370" y="230" width="190" height="60" as="geometry" />
17-
</mxCell>
18-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-2" target="OzNWH8DGC0_GQPN6JCz_-3" edge="1">
19-
<mxGeometry relative="1" as="geometry" />
20-
</mxCell>
21-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-37" value="Generates" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-36" vertex="1" connectable="0">
22-
<mxGeometry x="0.0991" y="1" relative="1" as="geometry">
23-
<mxPoint x="-8" y="1" as="offset" />
24-
</mxGeometry>
25-
</mxCell>
26-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-2" value="&lt;b&gt;Composite Resource Definition (XRD)&lt;/b&gt;&lt;div&gt;A custom API specification.&lt;/div&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
27-
<mxGeometry x="40" y="75" width="220" height="50" as="geometry" />
28-
</mxCell>
29-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-3" target="OzNWH8DGC0_GQPN6JCz_-1" edge="1">
30-
<mxGeometry relative="1" as="geometry" />
31-
</mxCell>
32-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-33" value="Triggers" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-32" vertex="1" connectable="0">
33-
<mxGeometry x="-0.0286" y="3" relative="1" as="geometry">
34-
<mxPoint x="-3" y="-4" as="offset" />
35-
</mxGeometry>
36-
</mxCell>
37-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-3" value="&lt;b&gt;Composite Resource (XR)&lt;/b&gt;&lt;div&gt;(Custom Resource Definition&lt;b&gt;)&lt;/b&gt;&lt;br&gt;Created by using the custom API defined in a CompositeResourceDefinition. XRs use the Composition template to create new managed resources.&lt;/div&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
38-
<mxGeometry x="347.5" y="50" width="235" height="100" as="geometry" />
39-
</mxCell>
40-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-5" target="OzNWH8DGC0_GQPN6JCz_-3" edge="1">
41-
<mxGeometry relative="1" as="geometry" />
42-
</mxCell>
43-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-30" value="Creates" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-11" vertex="1" connectable="0">
44-
<mxGeometry x="-0.1429" y="-1" relative="1" as="geometry">
45-
<mxPoint as="offset" />
46-
</mxGeometry>
47-
</mxCell>
48-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-5" value="&lt;b&gt;Claim (XRC)&lt;/b&gt;&lt;div&gt;Like a Composite Resource, but with namespace scoping.&lt;/div&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
49-
<mxGeometry x="670" y="65" width="180" height="70" as="geometry" />
50-
</mxCell>
51-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-13" target="OzNWH8DGC0_GQPN6JCz_-15" edge="1">
52-
<mxGeometry relative="1" as="geometry" />
53-
</mxCell>
54-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-13" value="&lt;b&gt;Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
55-
<mxGeometry x="405" y="370" width="120" height="60" as="geometry" />
56-
</mxCell>
57-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-15" value="&lt;b&gt;Managed Resourcse&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
58-
<mxGeometry x="370" y="510" width="190" height="60" as="geometry" />
59-
</mxCell>
60-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-17" value="&lt;b&gt;Managed Resourcse&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
61-
<mxGeometry x="380" y="520" width="190" height="60" as="geometry" />
62-
</mxCell>
63-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-18" value="&lt;b&gt;Managed Resourcse&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
64-
<mxGeometry x="390" y="530" width="190" height="60" as="geometry" />
65-
</mxCell>
66-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-19" value="&lt;b&gt;Managed Resourcse&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
67-
<mxGeometry x="400" y="540" width="190" height="60" as="geometry" />
68-
</mxCell>
69-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-26" target="OzNWH8DGC0_GQPN6JCz_-5" edge="1">
70-
<mxGeometry relative="1" as="geometry" />
71-
</mxCell>
72-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-29" value="Creates" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-27" vertex="1" connectable="0">
73-
<mxGeometry x="-0.0353" relative="1" as="geometry">
74-
<mxPoint as="offset" />
75-
</mxGeometry>
76-
</mxCell>
77-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-26" value="User" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" parent="1" vertex="1">
78-
<mxGeometry x="940" y="70" width="30" height="60" as="geometry" />
79-
</mxCell>
80-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-39" value="&lt;b&gt;Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
81-
<mxGeometry x="415" y="380" width="120" height="60" as="geometry" />
82-
</mxCell>
83-
<mxCell id="OzNWH8DGC0_GQPN6JCz_-40" value="&lt;b&gt;Composition Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
84-
<mxGeometry x="425" y="390" width="120" height="60" as="geometry" />
85-
</mxCell>
86-
</root>
87-
</mxGraphModel>
88-
</diagram>
89-
</mxfile>
1+
<mxfile host="65bd71144e">
2+
<diagram name="Page-1" id="ecw9FoG95bQOw1s2NnbU">
3+
<mxGraphModel dx="1044" dy="587" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-1" target="OzNWH8DGC0_GQPN6JCz_-13" edge="1">
8+
<mxGeometry relative="1" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-35" value="Triggers one or more" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-25" vertex="1" connectable="0">
11+
<mxGeometry x="-0.0667" y="-2" relative="1" as="geometry">
12+
<mxPoint as="offset"/>
13+
</mxGeometry>
14+
</mxCell>
15+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-1" value="&lt;b&gt;Composition&lt;/b&gt;&lt;div&gt;A template to define how to create resources.&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
16+
<mxGeometry x="370" y="230" width="190" height="60" as="geometry"/>
17+
</mxCell>
18+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-2" target="OzNWH8DGC0_GQPN6JCz_-3" edge="1">
19+
<mxGeometry relative="1" as="geometry"/>
20+
</mxCell>
21+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-37" value="Generates" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-36" vertex="1" connectable="0">
22+
<mxGeometry x="0.0991" y="1" relative="1" as="geometry">
23+
<mxPoint x="-8" y="1" as="offset"/>
24+
</mxGeometry>
25+
</mxCell>
26+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-2" value="&lt;b&gt;Composite Resource Definition (XRD)&lt;/b&gt;&lt;div&gt;Defines the XR’s schema.&lt;/div&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
27+
<mxGeometry x="40" y="75" width="220" height="50" as="geometry"/>
28+
</mxCell>
29+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-3" target="OzNWH8DGC0_GQPN6JCz_-1" edge="1">
30+
<mxGeometry relative="1" as="geometry"/>
31+
</mxCell>
32+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-33" value="Triggers" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-32" vertex="1" connectable="0">
33+
<mxGeometry x="-0.0286" y="3" relative="1" as="geometry">
34+
<mxPoint x="-3" y="-4" as="offset"/>
35+
</mxGeometry>
36+
</mxCell>
37+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-3" value="&lt;b&gt;Composite Resource (XR)&lt;/b&gt;&lt;div&gt;(Custom Resource Definition)&lt;br&gt;Created by using the custom API defined in a CompositeResourceDefinition. XRs use the Composition template to create new managed resources.&lt;/div&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
38+
<mxGeometry x="347.5" y="50" width="235" height="100" as="geometry"/>
39+
</mxCell>
40+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-26" target="OzNWH8DGC0_GQPN6JCz_-3" edge="1">
41+
<mxGeometry relative="1" as="geometry">
42+
<mxPoint x="670" y="100" as="sourcePoint"/>
43+
</mxGeometry>
44+
</mxCell>
45+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-30" value="Creates" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="OzNWH8DGC0_GQPN6JCz_-11" vertex="1" connectable="0">
46+
<mxGeometry x="-0.1429" y="-1" relative="1" as="geometry">
47+
<mxPoint as="offset"/>
48+
</mxGeometry>
49+
</mxCell>
50+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="OzNWH8DGC0_GQPN6JCz_-13" target="OzNWH8DGC0_GQPN6JCz_-15" edge="1">
51+
<mxGeometry relative="1" as="geometry"/>
52+
</mxCell>
53+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-13" value="&lt;b&gt;Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
54+
<mxGeometry x="405" y="370" width="120" height="60" as="geometry"/>
55+
</mxCell>
56+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-15" value="&lt;b style=&quot;color: rgb(63, 63, 63); scrollbar-color: rgb(226, 226, 226) rgb(251, 251, 251);&quot;&gt;Kubernetes Resources&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" parent="1" vertex="1">
57+
<mxGeometry x="370" y="510" width="190" height="60" as="geometry"/>
58+
</mxCell>
59+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-26" value="User" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" parent="1" vertex="1">
60+
<mxGeometry x="700" y="70" width="30" height="60" as="geometry"/>
61+
</mxCell>
62+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-39" value="&lt;b&gt;Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
63+
<mxGeometry x="415" y="380" width="120" height="60" as="geometry"/>
64+
</mxCell>
65+
<mxCell id="OzNWH8DGC0_GQPN6JCz_-40" value="&lt;b&gt;Composition Function&lt;/b&gt;" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" parent="1" vertex="1">
66+
<mxGeometry x="425" y="390" width="120" height="60" as="geometry"/>
67+
</mxCell>
68+
<mxCell id="2" value="&lt;b style=&quot;color: rgb(63, 63, 63); scrollbar-color: rgb(226, 226, 226) rgb(251, 251, 251);&quot;&gt;Kubernetes Resources&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" vertex="1" parent="1">
69+
<mxGeometry x="380" y="520" width="190" height="60" as="geometry"/>
70+
</mxCell>
71+
<mxCell id="3" value="&lt;b style=&quot;color: rgb(63, 63, 63); scrollbar-color: rgb(226, 226, 226) rgb(251, 251, 251);&quot;&gt;Kubernetes Resources&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" vertex="1" parent="1">
72+
<mxGeometry x="390" y="530" width="190" height="60" as="geometry"/>
73+
</mxCell>
74+
<mxCell id="4" value="&lt;b style=&quot;color: rgb(63, 63, 63); scrollbar-color: rgb(226, 226, 226) rgb(251, 251, 251);&quot;&gt;Kubernetes Resources&lt;/b&gt;" style="whiteSpace=wrap;html=1;verticalAlign=top;" vertex="1" parent="1">
75+
<mxGeometry x="400" y="540" width="190" height="60" as="geometry"/>
76+
</mxCell>
77+
</root>
78+
</mxGraphModel>
79+
</diagram>
80+
</mxfile>

src/Function.SDK.CSharp.Sample/ConversionWebhook.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ public static class ConversionWebhook
99
{
1010
public static V1ConversionReview Convert(V1ConversionReview conversion)
1111
{
12-
if (conversion.Kind == "ConversionReview"
13-
&& conversion.ApiVersion == "apiextensions.k8s.io/v1"
12+
if (conversion.Kind == V1ConversionReview.KubeKind
13+
&& conversion.ApiVersion == V1ConversionReview.KubeGroup + "/" + V1ConversionReview.KubeApiVersion
1414
&& conversion.Request?.DesiredApiVersion == V1alpha1XStorageBucket.KubeApiVersion
1515
)
1616
{
1717
foreach (var item in conversion.Request.Objects)
1818
{
19-
var source = KubernetesJson.Deserialize<V1alpha2XStorageBucket>(item.GetRawText());
19+
var source = KubernetesJson.Deserialize<V1alpha2XStorageBucket>(item);
2020
source.ApiVersion = V1alpha1XStorageBucket.KubeApiVersion;
2121

22-
var converted = JsonSerializer.Deserialize<JsonElement>(KubernetesJson.Serialize(source));
22+
var converted = KubernetesJson.Deserialize<JsonElement>(KubernetesJson.Serialize(source));
2323

2424
conversion.Response.ConvertedObjects.Add(converted);
2525
}
@@ -28,6 +28,7 @@ public static V1ConversionReview Convert(V1ConversionReview conversion)
2828
}
2929
else
3030
{
31+
conversion.Response.Uid = conversion.Request.Uid;
3132
conversion.Response.Result.Status = V1ConversionReviewResponseStatusEnum.Failure;
3233
conversion.Response.Result.Message = "Unknown Version";
3334
}

0 commit comments

Comments
 (0)