crossplane-function-pythonic 0.4.2__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/PKG-INFO +179 -25
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/README.md +177 -23
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/__about__.py +1 -1
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/composite.py +154 -5
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/function.py +24 -11
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/grpc.py +24 -3
- crossplane_function_pythonic-0.6.0/crossplane/pythonic/packages.py +180 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/protobuf.py +4 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/render.py +165 -79
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/cluster-function-pythonic.yaml +1 -1
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/context/composition.yaml +1 -1
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/context/resources.yaml +1 -1
- crossplane_function_pythonic-0.6.0/examples/inlined/composition.yaml +17 -0
- crossplane_function_pythonic-0.6.0/examples/inlined/definition.yaml +32 -0
- crossplane_function_pythonic-0.6.0/examples/inlined/render.sh +3 -0
- {crossplane_function_pythonic-0.4.2/examples/single-purpose → crossplane_function_pythonic-0.6.0/examples/inlined}/xr.yaml +3 -3
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/pyproject.toml +7 -7
- crossplane_function_pythonic-0.4.2/crossplane/pythonic/packages.py +0 -148
- crossplane_function_pythonic-0.4.2/examples/single-purpose/render.sh +0 -3
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/.gitignore +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/LICENSE +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/__init__.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/__main__.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/auto_ready.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/command.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/main.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/crossplane/pythonic/version.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/README.md +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/aks/kubernetescluster.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/aks/resourcegroup.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/install.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/kustomization.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/providers.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/aks-cluster/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/resources.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connection-details-composition/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connections/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connections/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connections/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connections/resources.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/connections/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/composition-v2.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/render-v2.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/eks-cluster/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/README.md +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/kustomization.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/runtime.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/vcluster.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/filing-system/vcluster.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/conditions/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/conditions/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/conditions/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/conditions/xrd.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/context/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/context/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/context/xrd.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/fromYaml/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/fromYaml/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/fromYaml/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getComposedResource/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getComposedResource/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getComposedResource/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getComposedResource/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCompositeResource/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCompositeResource/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCompositeResource/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCredentialData/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCredentialData/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCredentialData/resources.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getCredentialData/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getResourceCondition/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getResourceCondition/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getResourceCondition/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/getResourceCondition/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/include/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/include/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/include/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/toYaml/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/toYaml/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/functions/toYaml/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/inline/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/inline/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/inline/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/recursive/composition-real.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/recursive/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/recursive/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/recursive/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/required-resources/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/required-resources/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/required-resources/resources.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-go-templating/required-resources/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-sequencer/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-sequencer/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-sequencer/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-sequencer/sequencer.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/function-sequencer/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/get-started-app/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/get-started-app/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/get-started-app/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/get-started-app/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/get-started-app/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/kustomization.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/vcluster.py +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/helm-copy-secret/xrd.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/README.md +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/definition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/provider-ec2.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/import-existing-vpc/xr.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/run-all.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/usages-extra/composition.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/usages-extra/observed.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/usages-extra/render.sh +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/usages-extra/resources.yaml +0 -0
- {crossplane_function_pythonic-0.4.2 → crossplane_function_pythonic-0.6.0}/examples/usages-extra/xr.yaml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crossplane-function-pythonic
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A Python centric Crossplane Function
|
|
5
5
|
Project-URL: Documentation, https://github.com/crossplane-contrib/function-pythonic#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/crossplane-contrib/function-pythonic/issues
|
|
@@ -19,7 +19,7 @@ Requires-Dist: inflect==7.5.0
|
|
|
19
19
|
Requires-Dist: kr8s==0.20.15
|
|
20
20
|
Requires-Dist: pyyaml==6.0.3
|
|
21
21
|
Provides-Extra: packages
|
|
22
|
-
Requires-Dist: kopf==1.
|
|
22
|
+
Requires-Dist: kopf==1.44.4; extra == 'packages'
|
|
23
23
|
Provides-Extra: pip-install
|
|
24
24
|
Requires-Dist: pip==26.0.1; extra == 'pip-install'
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
@@ -83,7 +83,7 @@ kind: Function
|
|
|
83
83
|
metadata:
|
|
84
84
|
name: function-pythonic
|
|
85
85
|
spec:
|
|
86
|
-
package: xpkg.
|
|
86
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
### Crossplane V1
|
|
@@ -95,7 +95,7 @@ kind: Function
|
|
|
95
95
|
metadata:
|
|
96
96
|
name: function-pythonic
|
|
97
97
|
spec:
|
|
98
|
-
package: xpkg.
|
|
98
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
99
99
|
runtimeConfigRef:
|
|
100
100
|
name: function-pythonic
|
|
101
101
|
--
|
|
@@ -199,6 +199,11 @@ subnet.spec.forProvider.cidrBlock = '10.0.0.0/20'
|
|
|
199
199
|
```
|
|
200
200
|
Will generate the appropriate Crossplane Usage resource.
|
|
201
201
|
|
|
202
|
+
## API Documentation
|
|
203
|
+
|
|
204
|
+
- [Composite API (`composite.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/composite.md)
|
|
205
|
+
- [Protobuf Wrapper API (`protobuf.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/protobuf.md)
|
|
206
|
+
|
|
202
207
|
## Pythonic access of Protobuf Messages
|
|
203
208
|
|
|
204
209
|
All Protobuf messages are wrapped by a set of python classes which enable using
|
|
@@ -287,6 +292,7 @@ The BaseComposite class provides the following fields for manipulating the Compo
|
|
|
287
292
|
| self.metadata | Map | The composite observed metadata |
|
|
288
293
|
| self.spec | Map | The composite observed spec |
|
|
289
294
|
| self.status | Map | The composite desired and observed status, read from observed if not in desired |
|
|
295
|
+
| self.output | Map | The step output, only used during Operations |
|
|
290
296
|
| self.conditions | Conditions | The composite desired and observed conditions, read from observed if not in desired |
|
|
291
297
|
| self.results | Results | Returned results applied to the Composite and optionally on the Claim |
|
|
292
298
|
| self.connectionSecret | Map | The name, namespace, and resourceName to use when generating the connection secret in Crossplane v2 |
|
|
@@ -301,17 +307,31 @@ The BaseComposite also provides access to the following Crossplane Function leve
|
|
|
301
307
|
| self.request | Message | Low level direct access to the RunFunctionRequest message |
|
|
302
308
|
| self.response | Message | Low level direct access to the RunFunctionResponse message |
|
|
303
309
|
| self.logger | Logger | Python logger to log messages to the running function stdout |
|
|
310
|
+
| self.capabilities | Capabilities | This Crossplane version's Capabilities |
|
|
304
311
|
| self.parameters | Map | The configured step parameters |
|
|
305
312
|
| self.ttl | Integer | Get or set the response TTL, in seconds |
|
|
306
313
|
| self.credentials | Credentials | The request credentials |
|
|
307
314
|
| self.context | Map | The response context, initialized from the request context |
|
|
308
315
|
| self.environment | Map | The response environment, initialized from the request context environment |
|
|
309
316
|
| self.requireds | Requireds | Request and read additional local Kubernetes resources |
|
|
317
|
+
| self.schemas | Schemas | Request and read CustomResourceDefinition schemas |
|
|
310
318
|
| self.resources | Resources | Define and process composed resources |
|
|
311
319
|
| self.usages| Boolean | Generate Crossplane Usages for resource dependencies, default False |
|
|
312
320
|
| self.autoReady | Boolean | Perform auto ready processing on all composed resources, default True |
|
|
313
321
|
| self.unknownsFatal | Boolean | Terminate the composition if already created resources are assigned unknown values, default False |
|
|
314
322
|
|
|
323
|
+
### Capabiities
|
|
324
|
+
|
|
325
|
+
The Capabilities of the Crossplane version calling function-pythonic.
|
|
326
|
+
|
|
327
|
+
| Field | Type | Description |
|
|
328
|
+
| ----- | ---- | ----------- |
|
|
329
|
+
| bool(Capabilities) | Boolean | Whether or not the Crossplane version supports Capabilities |
|
|
330
|
+
| Capabiities.requireds | Boolean | Functions can return required resources and Crossplane will fetch the required resources |
|
|
331
|
+
| Capabiities.credentials | Boolean | Functions can receive credentials from secrets specified in the Composition |
|
|
332
|
+
| Capabiities.conditions | Boolean | Functions can return status conditions to be applied to the XR and optionally its claim |
|
|
333
|
+
| Capabiities.schemas | Boolean | Functions can request OpenAPI schemas and Crossplane will return them |
|
|
334
|
+
|
|
315
335
|
### Composed Resources
|
|
316
336
|
|
|
317
337
|
Creating and accessing composed resources is performed using the `BaseComposite.resources` field.
|
|
@@ -345,7 +365,7 @@ Resource class:
|
|
|
345
365
|
|
|
346
366
|
Creating and accessing required resources is performed using the `BaseComposite.requireds` field.
|
|
347
367
|
`BaseComposite.requireds` is a dictionary of the required resources whose key is the required
|
|
348
|
-
|
|
368
|
+
schema name. The value returned when getting a required resource from BaseComposite is the
|
|
349
369
|
following RequiredResources class:
|
|
350
370
|
|
|
351
371
|
| Field | Type | Description |
|
|
@@ -358,9 +378,6 @@ following RequiredResources class:
|
|
|
358
378
|
| RequiredResources.matchName | String | The names to match when returning the required resources |
|
|
359
379
|
| RequiredResources.matchLabels | Map | The labels to match when returning the required resources |
|
|
360
380
|
|
|
361
|
-
The current version of crossplane-sdk-python used by function-pythonic does not support namespace
|
|
362
|
-
selection. For now, use matchLabels and filter the results if required.
|
|
363
|
-
|
|
364
381
|
RequiredResources acts like a Python list to provide access to the found required resources.
|
|
365
382
|
Each resource in the list is the following RequiredResource class:
|
|
366
383
|
|
|
@@ -377,6 +394,22 @@ Each resource in the list is the following RequiredResource class:
|
|
|
377
394
|
| RequiredResource.conditions | Map | The required resource conditions |
|
|
378
395
|
| RequiredResource.connection | Map | The required resource connection details |
|
|
379
396
|
|
|
397
|
+
### Required Schemas
|
|
398
|
+
|
|
399
|
+
Creating and accessing required schemas is performed using the `BaseComposite.schemas` field.
|
|
400
|
+
`BaseComposite.schemas` is a dictionary of the required schema whose key is the required
|
|
401
|
+
resource name. The value returned when getting a required resource from BaseComposite is the
|
|
402
|
+
following Schema class:
|
|
403
|
+
|
|
404
|
+
| Field | Type | Description |
|
|
405
|
+
| ----- | ---- | ----------- |
|
|
406
|
+
| Schema(apiVersion,kind) | Schema | Reset the required schema and set the optional parameters |
|
|
407
|
+
| Schema.name | String | The required schema name |
|
|
408
|
+
| Schema.apiVersion | String | The required schema selector apiVersion |
|
|
409
|
+
| Schema.kind | String | The required schema selector kind |
|
|
410
|
+
| Schema.\_\_getitem\_\_ | Map | The required schema openAPIV3Schema |
|
|
411
|
+
| Schema.\_\_getattr\_\_ | Map | The required schema openAPIV3Schema |
|
|
412
|
+
|
|
380
413
|
### Conditions
|
|
381
414
|
|
|
382
415
|
The `BaseComposite.conditions`, `Resource.conditions`, and `RequiredResource.conditions` fields
|
|
@@ -406,25 +439,78 @@ optionally to the Claim.
|
|
|
406
439
|
| Result.message | String | Human-readable details about the result |
|
|
407
440
|
| Result.claim | Boolean | Also apply the result to the claim |
|
|
408
441
|
|
|
409
|
-
##
|
|
442
|
+
## Inlined Composites
|
|
410
443
|
|
|
411
444
|
Tired of creating a CompositeResourceDefinition, a Composition, and a Composite
|
|
412
|
-
just to run that Composition once in a
|
|
445
|
+
just to run that Composition once in a setup or initialize task?
|
|
413
446
|
|
|
414
|
-
function-pythonic
|
|
415
|
-
|
|
447
|
+
function-pythonic supports "inlined" Compositions, where the python module
|
|
448
|
+
is obtained from a field in the Composite's spec.
|
|
416
449
|
```yaml
|
|
417
|
-
apiVersion:
|
|
418
|
-
kind:
|
|
450
|
+
apiVersion: inlined.example.org/v1alpha1
|
|
451
|
+
kind: Step
|
|
419
452
|
metadata:
|
|
420
|
-
name:
|
|
453
|
+
name: inlined-example
|
|
421
454
|
spec:
|
|
422
455
|
composite: |
|
|
423
456
|
class HelloComposite(BaseComposite):
|
|
424
457
|
def compose(self):
|
|
425
|
-
self.status.
|
|
458
|
+
self.status.step = 'Hello, World!'
|
|
459
|
+
```
|
|
460
|
+
The CompositeResourceDefinition and Composition to support the above example:
|
|
461
|
+
```yaml
|
|
462
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
463
|
+
kind: CompositeResourceDefinition
|
|
464
|
+
metadata:
|
|
465
|
+
name: inlined.example.org/v1alpha1
|
|
466
|
+
spec:
|
|
467
|
+
group: inlined.example.org
|
|
468
|
+
names:
|
|
469
|
+
kind: Step
|
|
470
|
+
plural: steps
|
|
471
|
+
defaultCompositionRef:
|
|
472
|
+
name: steps.inlined.example.org
|
|
473
|
+
versions:
|
|
474
|
+
- name: v1alpha1
|
|
475
|
+
served: true
|
|
476
|
+
referenceable: true
|
|
477
|
+
schema:
|
|
478
|
+
openAPIV3Schema:
|
|
479
|
+
type: object
|
|
480
|
+
properties:
|
|
481
|
+
spec:
|
|
482
|
+
type: object
|
|
483
|
+
properties:
|
|
484
|
+
composite:
|
|
485
|
+
type: string
|
|
486
|
+
description: 'A Python module that defines a class with the signature: class Composite(BaseComposite)'
|
|
487
|
+
required:
|
|
488
|
+
- composite
|
|
489
|
+
status:
|
|
490
|
+
type: object
|
|
491
|
+
properties:
|
|
492
|
+
composite:
|
|
493
|
+
x-kubernetes-preserve-unknown-fields: true
|
|
494
|
+
```
|
|
495
|
+
```yaml
|
|
496
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
497
|
+
kind: Composition
|
|
498
|
+
metadata:
|
|
499
|
+
name: steps.inlined.example.org
|
|
500
|
+
spec:
|
|
501
|
+
compositeTypeRef:
|
|
502
|
+
apiVersion: inlined.example.org/v1alpha1
|
|
503
|
+
kind: Step
|
|
504
|
+
mode: Pipeline
|
|
505
|
+
pipeline:
|
|
506
|
+
- step: inlined
|
|
507
|
+
functionRef:
|
|
508
|
+
name: function-pythonic
|
|
509
|
+
input:
|
|
510
|
+
apiVersion: pythonic.fn.crossplane.io/v1alpha1
|
|
511
|
+
kind: Composite
|
|
512
|
+
inlined: composite
|
|
426
513
|
```
|
|
427
|
-
|
|
428
514
|
## Quick Start Development
|
|
429
515
|
|
|
430
516
|
function-pythonic includes a pure python implementation of the `crossplane render ...`
|
|
@@ -442,7 +528,7 @@ $ function-pythonic render --help
|
|
|
442
528
|
usage: Crossplane Function Pythonic render [-h] [--debug] [--log-name-width WIDTH] [--logger-level LOGGER=LEVEL] [--python-path DIRECTORY]
|
|
443
529
|
[--render-unknowns] [--allow-oversize-protos] [--crossplane-v1] [--kube-context CONTEXT]
|
|
444
530
|
[--context-files KEY=PATH] [--context-values KEY=VALUE] [--observed-resources PATH]
|
|
445
|
-
[--required-resources PATH] [--
|
|
531
|
+
[--required-resources PATH] [--required-schemas PATH] [--include-full-xr] [--include-connection-xr]
|
|
446
532
|
[--include-function-results] [--include-context]
|
|
447
533
|
COMPOSITE [COMPOSITION]
|
|
448
534
|
|
|
@@ -474,8 +560,8 @@ options:
|
|
|
474
560
|
A YAML file or directory of YAML files specifying the observed state of composed resources.
|
|
475
561
|
--required-resources, -e PATH
|
|
476
562
|
A YAML file or directory of YAML files specifying required resources to pass to the Function pipeline.
|
|
477
|
-
--
|
|
478
|
-
A
|
|
563
|
+
--required-schemas, -s PATH
|
|
564
|
+
A JSON file or directory of JSON files specifying required schemas to pass to the Function pipeline.
|
|
479
565
|
--include-full-xr, -x
|
|
480
566
|
Include a direct copy of the input XR's spedc and metadata fields in the rendered output.
|
|
481
567
|
--include-connection-xr
|
|
@@ -544,9 +630,15 @@ status:
|
|
|
544
630
|
Most of the examples contain a `render.sh` command which uses `function-pythonic render` to
|
|
545
631
|
render the example.
|
|
546
632
|
|
|
547
|
-
##
|
|
633
|
+
## Shared Python Packages
|
|
634
|
+
|
|
635
|
+
Python packages and modules can be added to the function-pythonic runtime
|
|
636
|
+
by including the python code in any of the following resources: ConfigMap,
|
|
637
|
+
Secret, EnvironmentConfig, or Composition
|
|
548
638
|
|
|
549
|
-
ConfigMap
|
|
639
|
+
### ConfigMap Packages
|
|
640
|
+
|
|
641
|
+
ConfigMap based python packages are enable using the `--packages-configmaps` and
|
|
550
642
|
`--packages-namespace` command line options. ConfigMaps with the label
|
|
551
643
|
`function-pythonic.package` will be incorporated in the python path at
|
|
552
644
|
the location configured in the label value. For example, the following
|
|
@@ -608,7 +700,7 @@ data:
|
|
|
608
700
|
composite: example.pythonic.features.FeatureOneComposite
|
|
609
701
|
...
|
|
610
702
|
```
|
|
611
|
-
This requires enabling the the packages support using the `--packages` command
|
|
703
|
+
This requires enabling the the packages support using the `--packages-configmaps` command
|
|
612
704
|
line option in the DeploymentRuntimeConfig and configuring the required
|
|
613
705
|
Kubernetes RBAC permissions. For example:
|
|
614
706
|
```yaml
|
|
@@ -617,7 +709,7 @@ kind: Function
|
|
|
617
709
|
metadata:
|
|
618
710
|
name: function-pythonic
|
|
619
711
|
spec:
|
|
620
|
-
package: xpkg.
|
|
712
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
621
713
|
runtimeConfigRef:
|
|
622
714
|
name: function-pythonic
|
|
623
715
|
---
|
|
@@ -679,9 +771,71 @@ ClusterRole permissions. The `--packages-namespace` command line option will res
|
|
|
679
771
|
to only using the supplied namespace. This option can be invoked multiple times.
|
|
680
772
|
The above RBAC permission can then be per namespace RBAC Role permissions.
|
|
681
773
|
|
|
774
|
+
### Secret Packages
|
|
775
|
+
|
|
682
776
|
Secrets can also be used in an identical manner as ConfigMaps by enabling the
|
|
683
777
|
`--packages-secrets` command line option. Secrets permissions need to be
|
|
684
|
-
added to the above RBAC configuration.
|
|
778
|
+
added to the above RBAC configuration. Secret based python packages also enable
|
|
779
|
+
provisioning files with binary data.
|
|
780
|
+
|
|
781
|
+
### EnvironmentConfig Packages
|
|
782
|
+
|
|
783
|
+
EnvironmentConfig based provisioning enable an entire package and module
|
|
784
|
+
directory structure. Use the `--packages-environmentconfigs` command line option
|
|
785
|
+
and configure the ClusterRole RBAC access.
|
|
786
|
+
```yaml
|
|
787
|
+
apiVersion: apiextensions.crossplane.io/v1beta1
|
|
788
|
+
kind: EnvironmentConfig
|
|
789
|
+
metadata:
|
|
790
|
+
name: test
|
|
791
|
+
labels:
|
|
792
|
+
function-pythonic.package: 'true'
|
|
793
|
+
data:
|
|
794
|
+
arootpackage:
|
|
795
|
+
asubpackage:
|
|
796
|
+
bmodule.py: |
|
|
797
|
+
def hello(where):
|
|
798
|
+
return f"Hello, {where}!"
|
|
799
|
+
amodule.py: |
|
|
800
|
+
def goodby(where):
|
|
801
|
+
return f"Goodby, {where}!"
|
|
802
|
+
```
|
|
803
|
+
### Composition Packages
|
|
804
|
+
|
|
805
|
+
Composition based provisioning works just like EnvironmentConfig where a
|
|
806
|
+
directory structure is created. Use the `--packages-compositions` command line option
|
|
807
|
+
and configure the ClusterRole RBAC access. The main reason to use Composition
|
|
808
|
+
based provision is because Compositions can be included in a Crossplane
|
|
809
|
+
Configuration Package.
|
|
810
|
+
```yaml
|
|
811
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
812
|
+
kind: Composition
|
|
813
|
+
metadata:
|
|
814
|
+
labels:
|
|
815
|
+
function-pythonic.package: 'true'
|
|
816
|
+
name: test
|
|
817
|
+
spec:
|
|
818
|
+
compositeTypeRef:
|
|
819
|
+
apiVersion: code.pythoni.com/v1alpha1
|
|
820
|
+
kind: Code
|
|
821
|
+
mode: Pipeline
|
|
822
|
+
pipeline:
|
|
823
|
+
- step: render
|
|
824
|
+
functionRef:
|
|
825
|
+
name: function-pythonic
|
|
826
|
+
input:
|
|
827
|
+
apiVersion: pythonic.fn.crossplane.io/v1alpha1
|
|
828
|
+
kind: Composite
|
|
829
|
+
packages:
|
|
830
|
+
arootpackage:
|
|
831
|
+
asubpackage:
|
|
832
|
+
bmodule.py: |
|
|
833
|
+
def hello(where):
|
|
834
|
+
return f"Hello, {where}!"
|
|
835
|
+
amodule.py: |
|
|
836
|
+
def goodby(where):
|
|
837
|
+
return f"Goodby, {where}!"
|
|
838
|
+
```
|
|
685
839
|
|
|
686
840
|
## Step Parameters
|
|
687
841
|
|
|
@@ -57,7 +57,7 @@ kind: Function
|
|
|
57
57
|
metadata:
|
|
58
58
|
name: function-pythonic
|
|
59
59
|
spec:
|
|
60
|
-
package: xpkg.
|
|
60
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Crossplane V1
|
|
@@ -69,7 +69,7 @@ kind: Function
|
|
|
69
69
|
metadata:
|
|
70
70
|
name: function-pythonic
|
|
71
71
|
spec:
|
|
72
|
-
package: xpkg.
|
|
72
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
73
73
|
runtimeConfigRef:
|
|
74
74
|
name: function-pythonic
|
|
75
75
|
--
|
|
@@ -173,6 +173,11 @@ subnet.spec.forProvider.cidrBlock = '10.0.0.0/20'
|
|
|
173
173
|
```
|
|
174
174
|
Will generate the appropriate Crossplane Usage resource.
|
|
175
175
|
|
|
176
|
+
## API Documentation
|
|
177
|
+
|
|
178
|
+
- [Composite API (`composite.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/composite.md)
|
|
179
|
+
- [Protobuf Wrapper API (`protobuf.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/protobuf.md)
|
|
180
|
+
|
|
176
181
|
## Pythonic access of Protobuf Messages
|
|
177
182
|
|
|
178
183
|
All Protobuf messages are wrapped by a set of python classes which enable using
|
|
@@ -261,6 +266,7 @@ The BaseComposite class provides the following fields for manipulating the Compo
|
|
|
261
266
|
| self.metadata | Map | The composite observed metadata |
|
|
262
267
|
| self.spec | Map | The composite observed spec |
|
|
263
268
|
| self.status | Map | The composite desired and observed status, read from observed if not in desired |
|
|
269
|
+
| self.output | Map | The step output, only used during Operations |
|
|
264
270
|
| self.conditions | Conditions | The composite desired and observed conditions, read from observed if not in desired |
|
|
265
271
|
| self.results | Results | Returned results applied to the Composite and optionally on the Claim |
|
|
266
272
|
| self.connectionSecret | Map | The name, namespace, and resourceName to use when generating the connection secret in Crossplane v2 |
|
|
@@ -275,17 +281,31 @@ The BaseComposite also provides access to the following Crossplane Function leve
|
|
|
275
281
|
| self.request | Message | Low level direct access to the RunFunctionRequest message |
|
|
276
282
|
| self.response | Message | Low level direct access to the RunFunctionResponse message |
|
|
277
283
|
| self.logger | Logger | Python logger to log messages to the running function stdout |
|
|
284
|
+
| self.capabilities | Capabilities | This Crossplane version's Capabilities |
|
|
278
285
|
| self.parameters | Map | The configured step parameters |
|
|
279
286
|
| self.ttl | Integer | Get or set the response TTL, in seconds |
|
|
280
287
|
| self.credentials | Credentials | The request credentials |
|
|
281
288
|
| self.context | Map | The response context, initialized from the request context |
|
|
282
289
|
| self.environment | Map | The response environment, initialized from the request context environment |
|
|
283
290
|
| self.requireds | Requireds | Request and read additional local Kubernetes resources |
|
|
291
|
+
| self.schemas | Schemas | Request and read CustomResourceDefinition schemas |
|
|
284
292
|
| self.resources | Resources | Define and process composed resources |
|
|
285
293
|
| self.usages| Boolean | Generate Crossplane Usages for resource dependencies, default False |
|
|
286
294
|
| self.autoReady | Boolean | Perform auto ready processing on all composed resources, default True |
|
|
287
295
|
| self.unknownsFatal | Boolean | Terminate the composition if already created resources are assigned unknown values, default False |
|
|
288
296
|
|
|
297
|
+
### Capabiities
|
|
298
|
+
|
|
299
|
+
The Capabilities of the Crossplane version calling function-pythonic.
|
|
300
|
+
|
|
301
|
+
| Field | Type | Description |
|
|
302
|
+
| ----- | ---- | ----------- |
|
|
303
|
+
| bool(Capabilities) | Boolean | Whether or not the Crossplane version supports Capabilities |
|
|
304
|
+
| Capabiities.requireds | Boolean | Functions can return required resources and Crossplane will fetch the required resources |
|
|
305
|
+
| Capabiities.credentials | Boolean | Functions can receive credentials from secrets specified in the Composition |
|
|
306
|
+
| Capabiities.conditions | Boolean | Functions can return status conditions to be applied to the XR and optionally its claim |
|
|
307
|
+
| Capabiities.schemas | Boolean | Functions can request OpenAPI schemas and Crossplane will return them |
|
|
308
|
+
|
|
289
309
|
### Composed Resources
|
|
290
310
|
|
|
291
311
|
Creating and accessing composed resources is performed using the `BaseComposite.resources` field.
|
|
@@ -319,7 +339,7 @@ Resource class:
|
|
|
319
339
|
|
|
320
340
|
Creating and accessing required resources is performed using the `BaseComposite.requireds` field.
|
|
321
341
|
`BaseComposite.requireds` is a dictionary of the required resources whose key is the required
|
|
322
|
-
|
|
342
|
+
schema name. The value returned when getting a required resource from BaseComposite is the
|
|
323
343
|
following RequiredResources class:
|
|
324
344
|
|
|
325
345
|
| Field | Type | Description |
|
|
@@ -332,9 +352,6 @@ following RequiredResources class:
|
|
|
332
352
|
| RequiredResources.matchName | String | The names to match when returning the required resources |
|
|
333
353
|
| RequiredResources.matchLabels | Map | The labels to match when returning the required resources |
|
|
334
354
|
|
|
335
|
-
The current version of crossplane-sdk-python used by function-pythonic does not support namespace
|
|
336
|
-
selection. For now, use matchLabels and filter the results if required.
|
|
337
|
-
|
|
338
355
|
RequiredResources acts like a Python list to provide access to the found required resources.
|
|
339
356
|
Each resource in the list is the following RequiredResource class:
|
|
340
357
|
|
|
@@ -351,6 +368,22 @@ Each resource in the list is the following RequiredResource class:
|
|
|
351
368
|
| RequiredResource.conditions | Map | The required resource conditions |
|
|
352
369
|
| RequiredResource.connection | Map | The required resource connection details |
|
|
353
370
|
|
|
371
|
+
### Required Schemas
|
|
372
|
+
|
|
373
|
+
Creating and accessing required schemas is performed using the `BaseComposite.schemas` field.
|
|
374
|
+
`BaseComposite.schemas` is a dictionary of the required schema whose key is the required
|
|
375
|
+
resource name. The value returned when getting a required resource from BaseComposite is the
|
|
376
|
+
following Schema class:
|
|
377
|
+
|
|
378
|
+
| Field | Type | Description |
|
|
379
|
+
| ----- | ---- | ----------- |
|
|
380
|
+
| Schema(apiVersion,kind) | Schema | Reset the required schema and set the optional parameters |
|
|
381
|
+
| Schema.name | String | The required schema name |
|
|
382
|
+
| Schema.apiVersion | String | The required schema selector apiVersion |
|
|
383
|
+
| Schema.kind | String | The required schema selector kind |
|
|
384
|
+
| Schema.\_\_getitem\_\_ | Map | The required schema openAPIV3Schema |
|
|
385
|
+
| Schema.\_\_getattr\_\_ | Map | The required schema openAPIV3Schema |
|
|
386
|
+
|
|
354
387
|
### Conditions
|
|
355
388
|
|
|
356
389
|
The `BaseComposite.conditions`, `Resource.conditions`, and `RequiredResource.conditions` fields
|
|
@@ -380,25 +413,78 @@ optionally to the Claim.
|
|
|
380
413
|
| Result.message | String | Human-readable details about the result |
|
|
381
414
|
| Result.claim | Boolean | Also apply the result to the claim |
|
|
382
415
|
|
|
383
|
-
##
|
|
416
|
+
## Inlined Composites
|
|
384
417
|
|
|
385
418
|
Tired of creating a CompositeResourceDefinition, a Composition, and a Composite
|
|
386
|
-
just to run that Composition once in a
|
|
419
|
+
just to run that Composition once in a setup or initialize task?
|
|
387
420
|
|
|
388
|
-
function-pythonic
|
|
389
|
-
|
|
421
|
+
function-pythonic supports "inlined" Compositions, where the python module
|
|
422
|
+
is obtained from a field in the Composite's spec.
|
|
390
423
|
```yaml
|
|
391
|
-
apiVersion:
|
|
392
|
-
kind:
|
|
424
|
+
apiVersion: inlined.example.org/v1alpha1
|
|
425
|
+
kind: Step
|
|
393
426
|
metadata:
|
|
394
|
-
name:
|
|
427
|
+
name: inlined-example
|
|
395
428
|
spec:
|
|
396
429
|
composite: |
|
|
397
430
|
class HelloComposite(BaseComposite):
|
|
398
431
|
def compose(self):
|
|
399
|
-
self.status.
|
|
432
|
+
self.status.step = 'Hello, World!'
|
|
433
|
+
```
|
|
434
|
+
The CompositeResourceDefinition and Composition to support the above example:
|
|
435
|
+
```yaml
|
|
436
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
437
|
+
kind: CompositeResourceDefinition
|
|
438
|
+
metadata:
|
|
439
|
+
name: inlined.example.org/v1alpha1
|
|
440
|
+
spec:
|
|
441
|
+
group: inlined.example.org
|
|
442
|
+
names:
|
|
443
|
+
kind: Step
|
|
444
|
+
plural: steps
|
|
445
|
+
defaultCompositionRef:
|
|
446
|
+
name: steps.inlined.example.org
|
|
447
|
+
versions:
|
|
448
|
+
- name: v1alpha1
|
|
449
|
+
served: true
|
|
450
|
+
referenceable: true
|
|
451
|
+
schema:
|
|
452
|
+
openAPIV3Schema:
|
|
453
|
+
type: object
|
|
454
|
+
properties:
|
|
455
|
+
spec:
|
|
456
|
+
type: object
|
|
457
|
+
properties:
|
|
458
|
+
composite:
|
|
459
|
+
type: string
|
|
460
|
+
description: 'A Python module that defines a class with the signature: class Composite(BaseComposite)'
|
|
461
|
+
required:
|
|
462
|
+
- composite
|
|
463
|
+
status:
|
|
464
|
+
type: object
|
|
465
|
+
properties:
|
|
466
|
+
composite:
|
|
467
|
+
x-kubernetes-preserve-unknown-fields: true
|
|
468
|
+
```
|
|
469
|
+
```yaml
|
|
470
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
471
|
+
kind: Composition
|
|
472
|
+
metadata:
|
|
473
|
+
name: steps.inlined.example.org
|
|
474
|
+
spec:
|
|
475
|
+
compositeTypeRef:
|
|
476
|
+
apiVersion: inlined.example.org/v1alpha1
|
|
477
|
+
kind: Step
|
|
478
|
+
mode: Pipeline
|
|
479
|
+
pipeline:
|
|
480
|
+
- step: inlined
|
|
481
|
+
functionRef:
|
|
482
|
+
name: function-pythonic
|
|
483
|
+
input:
|
|
484
|
+
apiVersion: pythonic.fn.crossplane.io/v1alpha1
|
|
485
|
+
kind: Composite
|
|
486
|
+
inlined: composite
|
|
400
487
|
```
|
|
401
|
-
|
|
402
488
|
## Quick Start Development
|
|
403
489
|
|
|
404
490
|
function-pythonic includes a pure python implementation of the `crossplane render ...`
|
|
@@ -416,7 +502,7 @@ $ function-pythonic render --help
|
|
|
416
502
|
usage: Crossplane Function Pythonic render [-h] [--debug] [--log-name-width WIDTH] [--logger-level LOGGER=LEVEL] [--python-path DIRECTORY]
|
|
417
503
|
[--render-unknowns] [--allow-oversize-protos] [--crossplane-v1] [--kube-context CONTEXT]
|
|
418
504
|
[--context-files KEY=PATH] [--context-values KEY=VALUE] [--observed-resources PATH]
|
|
419
|
-
[--required-resources PATH] [--
|
|
505
|
+
[--required-resources PATH] [--required-schemas PATH] [--include-full-xr] [--include-connection-xr]
|
|
420
506
|
[--include-function-results] [--include-context]
|
|
421
507
|
COMPOSITE [COMPOSITION]
|
|
422
508
|
|
|
@@ -448,8 +534,8 @@ options:
|
|
|
448
534
|
A YAML file or directory of YAML files specifying the observed state of composed resources.
|
|
449
535
|
--required-resources, -e PATH
|
|
450
536
|
A YAML file or directory of YAML files specifying required resources to pass to the Function pipeline.
|
|
451
|
-
--
|
|
452
|
-
A
|
|
537
|
+
--required-schemas, -s PATH
|
|
538
|
+
A JSON file or directory of JSON files specifying required schemas to pass to the Function pipeline.
|
|
453
539
|
--include-full-xr, -x
|
|
454
540
|
Include a direct copy of the input XR's spedc and metadata fields in the rendered output.
|
|
455
541
|
--include-connection-xr
|
|
@@ -518,9 +604,15 @@ status:
|
|
|
518
604
|
Most of the examples contain a `render.sh` command which uses `function-pythonic render` to
|
|
519
605
|
render the example.
|
|
520
606
|
|
|
521
|
-
##
|
|
607
|
+
## Shared Python Packages
|
|
608
|
+
|
|
609
|
+
Python packages and modules can be added to the function-pythonic runtime
|
|
610
|
+
by including the python code in any of the following resources: ConfigMap,
|
|
611
|
+
Secret, EnvironmentConfig, or Composition
|
|
522
612
|
|
|
523
|
-
ConfigMap
|
|
613
|
+
### ConfigMap Packages
|
|
614
|
+
|
|
615
|
+
ConfigMap based python packages are enable using the `--packages-configmaps` and
|
|
524
616
|
`--packages-namespace` command line options. ConfigMaps with the label
|
|
525
617
|
`function-pythonic.package` will be incorporated in the python path at
|
|
526
618
|
the location configured in the label value. For example, the following
|
|
@@ -582,7 +674,7 @@ data:
|
|
|
582
674
|
composite: example.pythonic.features.FeatureOneComposite
|
|
583
675
|
...
|
|
584
676
|
```
|
|
585
|
-
This requires enabling the the packages support using the `--packages` command
|
|
677
|
+
This requires enabling the the packages support using the `--packages-configmaps` command
|
|
586
678
|
line option in the DeploymentRuntimeConfig and configuring the required
|
|
587
679
|
Kubernetes RBAC permissions. For example:
|
|
588
680
|
```yaml
|
|
@@ -591,7 +683,7 @@ kind: Function
|
|
|
591
683
|
metadata:
|
|
592
684
|
name: function-pythonic
|
|
593
685
|
spec:
|
|
594
|
-
package: xpkg.
|
|
686
|
+
package: xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.6.0
|
|
595
687
|
runtimeConfigRef:
|
|
596
688
|
name: function-pythonic
|
|
597
689
|
---
|
|
@@ -653,9 +745,71 @@ ClusterRole permissions. The `--packages-namespace` command line option will res
|
|
|
653
745
|
to only using the supplied namespace. This option can be invoked multiple times.
|
|
654
746
|
The above RBAC permission can then be per namespace RBAC Role permissions.
|
|
655
747
|
|
|
748
|
+
### Secret Packages
|
|
749
|
+
|
|
656
750
|
Secrets can also be used in an identical manner as ConfigMaps by enabling the
|
|
657
751
|
`--packages-secrets` command line option. Secrets permissions need to be
|
|
658
|
-
added to the above RBAC configuration.
|
|
752
|
+
added to the above RBAC configuration. Secret based python packages also enable
|
|
753
|
+
provisioning files with binary data.
|
|
754
|
+
|
|
755
|
+
### EnvironmentConfig Packages
|
|
756
|
+
|
|
757
|
+
EnvironmentConfig based provisioning enable an entire package and module
|
|
758
|
+
directory structure. Use the `--packages-environmentconfigs` command line option
|
|
759
|
+
and configure the ClusterRole RBAC access.
|
|
760
|
+
```yaml
|
|
761
|
+
apiVersion: apiextensions.crossplane.io/v1beta1
|
|
762
|
+
kind: EnvironmentConfig
|
|
763
|
+
metadata:
|
|
764
|
+
name: test
|
|
765
|
+
labels:
|
|
766
|
+
function-pythonic.package: 'true'
|
|
767
|
+
data:
|
|
768
|
+
arootpackage:
|
|
769
|
+
asubpackage:
|
|
770
|
+
bmodule.py: |
|
|
771
|
+
def hello(where):
|
|
772
|
+
return f"Hello, {where}!"
|
|
773
|
+
amodule.py: |
|
|
774
|
+
def goodby(where):
|
|
775
|
+
return f"Goodby, {where}!"
|
|
776
|
+
```
|
|
777
|
+
### Composition Packages
|
|
778
|
+
|
|
779
|
+
Composition based provisioning works just like EnvironmentConfig where a
|
|
780
|
+
directory structure is created. Use the `--packages-compositions` command line option
|
|
781
|
+
and configure the ClusterRole RBAC access. The main reason to use Composition
|
|
782
|
+
based provision is because Compositions can be included in a Crossplane
|
|
783
|
+
Configuration Package.
|
|
784
|
+
```yaml
|
|
785
|
+
apiVersion: apiextensions.crossplane.io/v1
|
|
786
|
+
kind: Composition
|
|
787
|
+
metadata:
|
|
788
|
+
labels:
|
|
789
|
+
function-pythonic.package: 'true'
|
|
790
|
+
name: test
|
|
791
|
+
spec:
|
|
792
|
+
compositeTypeRef:
|
|
793
|
+
apiVersion: code.pythoni.com/v1alpha1
|
|
794
|
+
kind: Code
|
|
795
|
+
mode: Pipeline
|
|
796
|
+
pipeline:
|
|
797
|
+
- step: render
|
|
798
|
+
functionRef:
|
|
799
|
+
name: function-pythonic
|
|
800
|
+
input:
|
|
801
|
+
apiVersion: pythonic.fn.crossplane.io/v1alpha1
|
|
802
|
+
kind: Composite
|
|
803
|
+
packages:
|
|
804
|
+
arootpackage:
|
|
805
|
+
asubpackage:
|
|
806
|
+
bmodule.py: |
|
|
807
|
+
def hello(where):
|
|
808
|
+
return f"Hello, {where}!"
|
|
809
|
+
amodule.py: |
|
|
810
|
+
def goodby(where):
|
|
811
|
+
return f"Goodby, {where}!"
|
|
812
|
+
```
|
|
659
813
|
|
|
660
814
|
## Step Parameters
|
|
661
815
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# This is set at build time, using "hatch version"
|
|
2
|
-
__version__ = "0.
|
|
2
|
+
__version__ = "0.6.0"
|