crossplane-function-pythonic 0.6.0__tar.gz → 0.6.2__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.
Files changed (134) hide show
  1. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/.gitignore +1 -0
  2. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/PKG-INFO +7 -5
  3. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/README.md +1 -0
  4. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/__about__.py +1 -1
  5. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/composite.py +6 -3
  6. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/function.py +25 -12
  7. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/grpc.py +2 -1
  8. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/packages.py +14 -10
  9. crossplane_function_pythonic-0.6.2/crossplane/pythonic/proto/v1/run_function.proto +436 -0
  10. crossplane_function_pythonic-0.6.2/crossplane/pythonic/proto/v1/run_function_pb2.py +129 -0
  11. crossplane_function_pythonic-0.6.2/crossplane/pythonic/proto/v1/run_function_pb2.pyi +306 -0
  12. crossplane_function_pythonic-0.6.2/crossplane/pythonic/proto/v1/run_function_pb2_grpc.py +101 -0
  13. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/protobuf.py +26 -0
  14. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/render.py +8 -3
  15. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/pyproject.toml +24 -10
  16. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/LICENSE +0 -0
  17. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/__init__.py +0 -0
  18. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/__main__.py +0 -0
  19. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/auto_ready.py +0 -0
  20. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/command.py +0 -0
  21. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/main.py +0 -0
  22. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/crossplane/pythonic/version.py +0 -0
  23. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/README.md +0 -0
  24. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/aks/kubernetescluster.py +0 -0
  25. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/aks/resourcegroup.py +0 -0
  26. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/cluster-function-pythonic.yaml +0 -0
  27. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/composition.yaml +0 -0
  28. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/definition.yaml +0 -0
  29. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/install.sh +0 -0
  30. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/kustomization.yaml +0 -0
  31. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/providers.yaml +0 -0
  32. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/render.sh +0 -0
  33. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/aks-cluster/xr.yaml +0 -0
  34. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/composition.yaml +0 -0
  35. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/definition.yaml +0 -0
  36. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/observed.yaml +0 -0
  37. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/render.sh +0 -0
  38. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/resources.yaml +0 -0
  39. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connection-details-composition/xr.yaml +0 -0
  40. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connections/composition.yaml +0 -0
  41. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connections/observed.yaml +0 -0
  42. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connections/render.sh +0 -0
  43. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connections/resources.yaml +0 -0
  44. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/connections/xr.yaml +0 -0
  45. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/composition-v2.yaml +0 -0
  46. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/composition.yaml +0 -0
  47. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/definition.yaml +0 -0
  48. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/render-v2.sh +0 -0
  49. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/render.sh +0 -0
  50. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/eks-cluster/xr.yaml +0 -0
  51. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/README.md +0 -0
  52. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/composition.yaml +0 -0
  53. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/definition.yaml +0 -0
  54. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/kustomization.yaml +0 -0
  55. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/runtime.yaml +0 -0
  56. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/vcluster.py +0 -0
  57. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/filing-system/vcluster.yaml +0 -0
  58. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/conditions/composition.yaml +0 -0
  59. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/conditions/render.sh +0 -0
  60. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/conditions/xr.yaml +0 -0
  61. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/conditions/xrd.yaml +0 -0
  62. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/context/composition.yaml +0 -0
  63. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/context/render.sh +0 -0
  64. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/context/resources.yaml +0 -0
  65. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/context/xr.yaml +0 -0
  66. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/context/xrd.yaml +0 -0
  67. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/fromYaml/composition.yaml +0 -0
  68. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/fromYaml/render.sh +0 -0
  69. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/fromYaml/xr.yaml +0 -0
  70. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getComposedResource/composition.yaml +0 -0
  71. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getComposedResource/observed.yaml +0 -0
  72. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getComposedResource/render.sh +0 -0
  73. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getComposedResource/xr.yaml +0 -0
  74. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCompositeResource/composition.yaml +0 -0
  75. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCompositeResource/render.sh +0 -0
  76. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCompositeResource/xr.yaml +0 -0
  77. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCredentialData/composition.yaml +0 -0
  78. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCredentialData/render.sh +0 -0
  79. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCredentialData/resources.yaml +0 -0
  80. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getCredentialData/xr.yaml +0 -0
  81. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getResourceCondition/composition.yaml +0 -0
  82. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getResourceCondition/observed.yaml +0 -0
  83. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getResourceCondition/render.sh +0 -0
  84. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/getResourceCondition/xr.yaml +0 -0
  85. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/include/composition.yaml +0 -0
  86. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/include/render.sh +0 -0
  87. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/include/xr.yaml +0 -0
  88. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/toYaml/composition.yaml +0 -0
  89. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/toYaml/render.sh +0 -0
  90. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/functions/toYaml/xr.yaml +0 -0
  91. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/inline/composition.yaml +0 -0
  92. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/inline/render.sh +0 -0
  93. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/inline/xr.yaml +0 -0
  94. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/recursive/composition-real.yaml +0 -0
  95. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/recursive/composition.yaml +0 -0
  96. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/recursive/render.sh +0 -0
  97. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/recursive/xr.yaml +0 -0
  98. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/required-resources/composition.yaml +0 -0
  99. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/required-resources/render.sh +0 -0
  100. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/required-resources/resources.yaml +0 -0
  101. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-go-templating/required-resources/xr.yaml +0 -0
  102. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-sequencer/composition.yaml +0 -0
  103. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-sequencer/observed.yaml +0 -0
  104. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-sequencer/render.sh +0 -0
  105. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-sequencer/sequencer.py +0 -0
  106. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/function-sequencer/xr.yaml +0 -0
  107. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/get-started-app/composition.yaml +0 -0
  108. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/get-started-app/definition.yaml +0 -0
  109. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/get-started-app/observed.yaml +0 -0
  110. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/get-started-app/render.sh +0 -0
  111. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/get-started-app/xr.yaml +0 -0
  112. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/composition.yaml +0 -0
  113. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/kustomization.yaml +0 -0
  114. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/render.sh +0 -0
  115. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/vcluster.py +0 -0
  116. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/xr.yaml +0 -0
  117. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/helm-copy-secret/xrd.yaml +0 -0
  118. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/README.md +0 -0
  119. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/composition.yaml +0 -0
  120. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/definition.yaml +0 -0
  121. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/observed.yaml +0 -0
  122. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/provider-ec2.yaml +0 -0
  123. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/render.sh +0 -0
  124. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/import-existing-vpc/xr.yaml +0 -0
  125. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/inlined/composition.yaml +0 -0
  126. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/inlined/definition.yaml +0 -0
  127. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/inlined/render.sh +0 -0
  128. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/inlined/xr.yaml +0 -0
  129. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/run-all.sh +0 -0
  130. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/usages-extra/composition.yaml +0 -0
  131. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/usages-extra/observed.yaml +0 -0
  132. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/usages-extra/render.sh +0 -0
  133. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/usages-extra/resources.yaml +0 -0
  134. {crossplane_function_pythonic-0.6.0 → crossplane_function_pythonic-0.6.2}/examples/usages-extra/xr.yaml +0 -0
@@ -212,6 +212,7 @@ __marimo__/
212
212
 
213
213
  # function-pythonic
214
214
  crossplane/pythonic/__version__.py
215
+ crossplane/pythonic/proto/v1/run_function_pb2*
215
216
  pocs/
216
217
  pythonic-packages/
217
218
  tests/protobuf/pytest_pb2*
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: crossplane-function-pythonic
3
- Version: 0.6.0
3
+ Version: 0.6.2
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
@@ -14,14 +14,15 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
16
  Requires-Python: <3.15,>=3.12
17
- Requires-Dist: crossplane-function-sdk-python==0.11.0
17
+ Requires-Dist: grpcio==1.83.0
18
18
  Requires-Dist: inflect==7.5.0
19
19
  Requires-Dist: kr8s==0.20.15
20
+ Requires-Dist: protobuf==7.35.1
20
21
  Requires-Dist: pyyaml==6.0.3
21
22
  Provides-Extra: packages
22
- Requires-Dist: kopf==1.44.4; extra == 'packages'
23
+ Requires-Dist: kopf==1.44.6; extra == 'packages'
23
24
  Provides-Extra: pip-install
24
- Requires-Dist: pip==26.0.1; extra == 'pip-install'
25
+ Requires-Dist: pip==26.2.1; extra == 'pip-install'
25
26
  Description-Content-Type: text/markdown
26
27
 
27
28
  # function-pythonic
@@ -314,6 +315,7 @@ The BaseComposite also provides access to the following Crossplane Function leve
314
315
  | self.context | Map | The response context, initialized from the request context |
315
316
  | self.environment | Map | The response environment, initialized from the request context environment |
316
317
  | self.requireds | Requireds | Request and read additional local Kubernetes resources |
318
+ | self.watched | RequiredResource | THe WatchOperation's changed resource |
317
319
  | self.schemas | Schemas | Request and read CustomResourceDefinition schemas |
318
320
  | self.resources | Resources | Define and process composed resources |
319
321
  | self.usages| Boolean | Generate Crossplane Usages for resource dependencies, default False |
@@ -288,6 +288,7 @@ The BaseComposite also provides access to the following Crossplane Function leve
288
288
  | self.context | Map | The response context, initialized from the request context |
289
289
  | self.environment | Map | The response environment, initialized from the request context environment |
290
290
  | self.requireds | Requireds | Request and read additional local Kubernetes resources |
291
+ | self.watched | RequiredResource | THe WatchOperation's changed resource |
291
292
  | self.schemas | Schemas | Request and read CustomResourceDefinition schemas |
292
293
  | self.resources | Resources | Define and process composed resources |
293
294
  | self.usages| Boolean | Generate Crossplane Usages for resource dependencies, default False |
@@ -1,2 +1,2 @@
1
1
  # This is set at build time, using "hatch version"
2
- __version__ = "0.6.0"
2
+ __version__ = "0.6.2"
@@ -1,10 +1,12 @@
1
1
 
2
2
  import datetime
3
3
  from google.protobuf.duration_pb2 import Duration
4
- from crossplane.function.proto.v1 import run_function_pb2 as fnv1
5
4
 
6
- from . import auto_ready
7
- from . import protobuf
5
+ from . import (
6
+ auto_ready,
7
+ protobuf,
8
+ )
9
+ from .proto.v1 import run_function_pb2 as fnv1
8
10
 
9
11
 
10
12
  _notset = object()
@@ -110,6 +112,7 @@ class BaseComposite:
110
112
  self.context = self.response.context
111
113
  self.environment = self.context['apiextensions.crossplane.io/environment']
112
114
  self.requireds = Requireds(self)
115
+ self.watched = self.requireds['ops.crossplane.io/watched-resource'][0]
113
116
  self.schemas = Schemas(self)
114
117
  self.resources = Resources(self)
115
118
  self.autoReady = True
@@ -7,8 +7,8 @@ import logging
7
7
  import sys
8
8
 
9
9
  import grpc
10
- from crossplane.function.proto.v1 import run_function_pb2 as fnv1
11
- from crossplane.function.proto.v1 import run_function_pb2_grpc as grpcv1
10
+ from .proto.v1 import run_function_pb2 as fnv1
11
+ from .proto.v1 import run_function_pb2_grpc as grpcv1
12
12
  from .. import pythonic
13
13
 
14
14
  logger = logging.getLogger(__name__)
@@ -43,19 +43,26 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
43
43
 
44
44
  async def run_function(self, request):
45
45
  composite = request.observed.composite.resource
46
- name = list(reversed(composite['apiVersion'].split('/')[0].split('.')))
47
- name.append(composite['kind'])
48
- name.append(composite['metadata']['name'])
49
- logger = logging.getLogger('.'.join(name))
50
-
51
- if 'inlined' in request.input and request.input['inlined']:
52
- if 'spec' not in composite or request.input['inlined'] not in composite['spec']:
53
- return self.fatal(request, logger, f"Missing inlined spec.{request.input['inlined']}")
54
- composite = composite['spec'][request.input['inlined']]
46
+ if composite and composite.fields:
47
+ name = list(reversed(composite['apiVersion'].split('/')[0].split('.')))
48
+ name.append(composite['kind'])
49
+ name.append(composite['metadata']['name'])
50
+ logger = logging.getLogger('.'.join(name))
51
+ if 'inlined' in request.input and request.input['inlined']:
52
+ if 'spec' not in composite or request.input['inlined'] not in composite['spec']:
53
+ return self.fatal(request, logger, f"Missing inlined spec.{request.input['inlined']}")
54
+ composite = composite['spec'][request.input['inlined']]
55
+ else:
56
+ if 'composite' not in request.input:
57
+ return self.fatal(request, logger, 'Missing composition input "composite"')
58
+ composite = request.input['composite']
59
+ operation = False
55
60
  else:
61
+ logger = logging.getLogger('operation')
56
62
  if 'composite' not in request.input:
57
- return self.fatal(request, logger, 'Missing input "composite"')
63
+ return self.fatal(request, logger, 'Missing operation input "composite"')
58
64
  composite = request.input['composite']
65
+ operation = True
59
66
 
60
67
  # Ideally this is something the Function API provides
61
68
  if 'step' in request.input:
@@ -97,6 +104,12 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
97
104
  return self.fatal(request, logger, f"{composite} is not a subclass of BaseComposite")
98
105
  self.clazzes[composite] = clazz
99
106
 
107
+ if operation:
108
+ if '\n' in composite:
109
+ logger = logging.getLogger(f"operation.{clazz.__name__}")
110
+ else:
111
+ logger = logging.getLogger(f"operation.{composite}")
112
+
100
113
  try:
101
114
  composite = clazz(self.crossplane_v1, request, logger)
102
115
  except Exception as e:
@@ -7,7 +7,6 @@ import shlex
7
7
  import signal
8
8
  import sys
9
9
 
10
- import crossplane.function.proto.v1.run_function_pb2_grpc as grpcv1
11
10
  import grpc
12
11
 
13
12
  from . import (
@@ -15,6 +14,8 @@ from . import (
15
14
  command,
16
15
  function,
17
16
  )
17
+ from .proto.v1 import run_function_pb2_grpc as grpcv1
18
+
18
19
 
19
20
  logger = logging.getLogger(__name__)
20
21
 
@@ -158,19 +158,23 @@ def package_delete(action, package_dir, package, logger):
158
158
 
159
159
  def validate_entry(name, value, logger):
160
160
  if isinstance(value, str):
161
- if not name.endswith('.py'):
162
- if '.' in name or '/' in name:
163
- logger.error(f"Python package file name is not valid: {name}")
161
+ if name.endswith('.py'):
162
+ name = name[:-3]
163
+ if not name.isidentifier():
164
+ logger.error(f"Python module name is not an identifier: {name}")
164
165
  return False
165
- return True
166
- name = name[:-3]
167
- elif not isinstance(value, dict):
166
+ else:
167
+ if '/' in name:
168
+ logger.error(f"Python file name is not valid: {name}")
169
+ return False
170
+ elif isinstance(value, dict):
171
+ if not name.isidentifier():
172
+ logger.error(f"Python package name is not an identifier: {name}")
173
+ return False
174
+ else:
168
175
  logger.error(f"Python package \"{name}\" value is not a valid type: {value.__class__}")
169
176
  return False
170
- if name.isidentifier():
171
- return True
172
- logger.error(f"Python package name is not an identifier: {name}")
173
- return False
177
+ return True
174
178
 
175
179
 
176
180
  def package_file_name(package_name):
@@ -0,0 +1,436 @@
1
+ /*
2
+ Copyright 2022 The Crossplane Authors.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ syntax = "proto3";
18
+
19
+ // This package defines the RPC for both composition and operation functions.
20
+ // Only composition functions are part of the 'apiextensions' API group. In
21
+ // retrospect this package should've been crossplane.proto.fn.v1, but it's too
22
+ // late to change it now.
23
+
24
+ //buf:lint:ignore PACKAGE_DIRECTORY_MATCH
25
+ package apiextensions.fn.proto.v1;
26
+
27
+ import "google/protobuf/duration.proto";
28
+ import "google/protobuf/struct.proto";
29
+
30
+ option go_package = "github.com/crossplane/crossplane/v2/proto/fn/v1";
31
+
32
+ // A FunctionRunnerService is a function.
33
+ service FunctionRunnerService {
34
+ // RunFunction runs the function.
35
+ rpc RunFunction(RunFunctionRequest) returns (RunFunctionResponse) {}
36
+ }
37
+
38
+ // A RunFunctionRequest requests that the function be run.
39
+ message RunFunctionRequest {
40
+ // Metadata pertaining to this request.
41
+ RequestMeta meta = 1;
42
+
43
+ // The observed state prior to invocation of a function pipeline. State passed
44
+ // to each function is fresh as of the time the pipeline was invoked, not as
45
+ // of the time each function was invoked.
46
+ State observed = 2;
47
+
48
+ // Desired state according to a function pipeline. The state passed to a
49
+ // particular function may have been accumulated by previous functions in the
50
+ // pipeline.
51
+ //
52
+ // Note that the desired state must be a partial object with only the fields
53
+ // that this function (and its predecessors in the pipeline) wants to have set
54
+ // in the object. Copying a non-partial observed state to desired is most
55
+ // likely not what you want to do. Leaving out fields that had been returned
56
+ // as desired before will result in them being deleted from the objects in the
57
+ // cluster.
58
+ State desired = 3;
59
+
60
+ // Optional input specific to this function invocation. A JSON representation
61
+ // of the 'input' block of the relevant entry in a function pipeline.
62
+ optional google.protobuf.Struct input = 4;
63
+
64
+ // Optional context. Crossplane may pass arbitrary contextual information to a
65
+ // function. A function may also return context in its RunFunctionResponse,
66
+ // and that context will be passed to subsequent functions. Crossplane
67
+ // discards all context returned by the last function in the pipeline.
68
+ optional google.protobuf.Struct context = 5;
69
+
70
+ // Optional resources that the function specified in its requirements. Note
71
+ // that resources is a map to Resources, plural. The map key corresponds to
72
+ // the key in a RunFunctionResponse's requirements.extra_resources field. If a
73
+ // function requested extra resources that did not exist, Crossplane sets
74
+ // the map key to an empty Resources message to indicate that it attempted to
75
+ // satisfy the request. This field is only populated when the function uses
76
+ // extra_resources in its requirements.
77
+ //
78
+ // Deprecated: Use required_resources instead.
79
+ map<string, Resources> extra_resources = 6 [deprecated = true];
80
+
81
+ // Optional credentials that this function may use to communicate with an
82
+ // external system.
83
+ map<string, Credentials> credentials = 7;
84
+
85
+ // Optional resources that the function specified in its requirements. Note
86
+ // that resources is a map to Resources, plural. The map key corresponds to
87
+ // the key in a RunFunctionResponse's requirements.resources field. If a
88
+ // function requested required resources that did not exist, Crossplane sets
89
+ // the map key to an empty Resources message to indicate that it attempted to
90
+ // satisfy the request. This field is only populated when the function uses
91
+ // resources in its requirements.
92
+ map<string, Resources> required_resources = 8;
93
+
94
+ // Optional schemas that the function specified in its requirements. The map
95
+ // key corresponds to the key in a RunFunctionResponse's requirements.schemas
96
+ // field. If a function requested a schema that could not be found, Crossplane
97
+ // sets the map key to an empty Schema message to indicate that it attempted
98
+ // to satisfy the request.
99
+ map<string, Schema> required_schemas = 9;
100
+ }
101
+
102
+ // Credentials that a function may use to communicate with an external system.
103
+ message Credentials {
104
+ // Source of the credentials.
105
+ oneof source {
106
+ // Credential data loaded by Crossplane, for example from a Secret.
107
+ CredentialData credential_data = 1;
108
+ }
109
+ }
110
+
111
+ // CredentialData loaded by Crossplane, for example from a Secret.
112
+ message CredentialData {
113
+ map<string, bytes> data = 1;
114
+ }
115
+
116
+ // Resources represents the state of several Crossplane resources.
117
+ message Resources {
118
+ repeated Resource items = 1;
119
+ }
120
+
121
+ // A RunFunctionResponse contains the result of a function run.
122
+ message RunFunctionResponse {
123
+ // Metadata pertaining to this response.
124
+ ResponseMeta meta = 1;
125
+
126
+ // Desired state according to a function pipeline. functions may add desired
127
+ // state, and may mutate or delete any part of the desired state they are
128
+ // concerned with. A function must pass through any part of the desired state
129
+ // that it is not concerned with.
130
+ //
131
+ // Note that the desired state must be a partial object with only the fields
132
+ // that this function (and its predecessors in the pipeline) wants to have set
133
+ // in the object. Copying a non-partial observed state to desired is most
134
+ // likely not what you want to do. Leaving out fields that had been returned
135
+ // as desired before will result in them being deleted from the objects in the
136
+ // cluster.
137
+ State desired = 2;
138
+
139
+ // Results of the function run. Results are used for observability purposes.
140
+ repeated Result results = 3;
141
+
142
+ // Optional context to be passed to the next function in the pipeline as part
143
+ // of the RunFunctionRequest. Dropped on the last function in the pipeline.
144
+ optional google.protobuf.Struct context = 4;
145
+
146
+ // Requirements that must be satisfied for this function to run successfully.
147
+ Requirements requirements = 5;
148
+
149
+ // Status conditions to be applied to the XR. Conditions may also optionally
150
+ // be applied to the XR's associated claim.
151
+ //
152
+ // Conditions are only used for composition. They're ignored by Operations.
153
+ repeated Condition conditions = 6;
154
+
155
+ // Optional output specific to this function invocation.
156
+ //
157
+ // Only Operations use function output. XRs will discard any function output.
158
+ optional google.protobuf.Struct output = 7;
159
+ }
160
+
161
+ // RequestMeta contains metadata pertaining to a RunFunctionRequest.
162
+ message RequestMeta {
163
+ // An opaque string identifying a request. Requests with identical tags will
164
+ // be otherwise identical.
165
+ string tag = 1;
166
+
167
+ // Capabilities supported by this version of Crossplane. Functions may use
168
+ // this to determine whether Crossplane will honor certain fields in their
169
+ // response, or populate certain fields in their request.
170
+ repeated Capability capabilities = 2;
171
+ }
172
+
173
+ // Capability indicates that Crossplane supports a particular feature.
174
+ // Functions can check for capabilities to determine whether Crossplane will
175
+ // honor a particular request or response field.
176
+ enum Capability {
177
+ CAPABILITY_UNSPECIFIED = 0;
178
+
179
+ // Crossplane sends capabilities in RequestMeta. If this capability is
180
+ // present, the function knows that if another capability is absent, it's
181
+ // because Crossplane doesn't support it (not because Crossplane predates
182
+ // capability advertisement). Added in Crossplane v2.2.
183
+ CAPABILITY_CAPABILITIES = 1;
184
+
185
+ // Crossplane supports the requirements.resources field. Functions can return
186
+ // resource requirements and Crossplane will fetch the requested resources and
187
+ // return them in required_resources. Added in Crossplane v1.15.
188
+ CAPABILITY_REQUIRED_RESOURCES = 2;
189
+
190
+ // Crossplane supports the credentials field. Functions can receive
191
+ // credentials from secrets specified in the Composition. Added in Crossplane
192
+ // v1.16.
193
+ CAPABILITY_CREDENTIALS = 3;
194
+
195
+ // Crossplane supports the conditions field. Functions can return status
196
+ // conditions to be applied to the XR and optionally its claim. Added in
197
+ // Crossplane v1.17.
198
+ CAPABILITY_CONDITIONS = 4;
199
+
200
+ // Crossplane supports the requirements.schemas field. Functions can request
201
+ // OpenAPI schemas and Crossplane will return them in required_schemas. Added
202
+ // in Crossplane v2.2.
203
+ CAPABILITY_REQUIRED_SCHEMAS = 5;
204
+ }
205
+
206
+ // Requirements that must be satisfied for a function to run successfully.
207
+ message Requirements {
208
+ // Resources that this function requires. The map key uniquely identifies the
209
+ // group of resources.
210
+ //
211
+ // Deprecated: Use resources instead.
212
+ map<string, ResourceSelector> extra_resources = 1 [deprecated = true];
213
+
214
+ // Resources that this function requires. The map key uniquely identifies the
215
+ // group of resources.
216
+ map<string, ResourceSelector> resources = 2;
217
+
218
+ // Schemas that this function requires. The map key uniquely identifies the
219
+ // schema request.
220
+ map<string, SchemaSelector> schemas = 3;
221
+ }
222
+
223
+ // SchemaSelector identifies a resource kind whose OpenAPI schema is requested.
224
+ message SchemaSelector {
225
+ // API version of the resource kind, e.g. "example.org/v1".
226
+ string api_version = 1;
227
+
228
+ // Kind of resource, e.g. "MyResource".
229
+ string kind = 2;
230
+ }
231
+
232
+ // Schema represents the OpenAPI schema for a resource kind.
233
+ message Schema {
234
+ // The OpenAPI v3 schema of the resource kind as unstructured JSON.
235
+ // For CRDs this is the spec.versions[].schema.openAPIV3Schema field.
236
+ // Empty if Crossplane could not find a schema for the requested kind.
237
+ optional google.protobuf.Struct openapi_v3 = 1;
238
+ }
239
+
240
+ // ResourceSelector selects a group of resources, either by name or by label.
241
+ message ResourceSelector {
242
+ // API version of resources to select.
243
+ string api_version = 1;
244
+
245
+ // Kind of resources to select.
246
+ string kind = 2;
247
+
248
+ // Resources to match.
249
+ oneof match {
250
+ // Match the resource with this name.
251
+ string match_name = 3;
252
+
253
+ // Match all resources with these labels.
254
+ MatchLabels match_labels = 4;
255
+ }
256
+
257
+ // Match resources in this namespace. Omit namespace to match cluster scoped
258
+ // resources, or to match namespaced resources by labels across all
259
+ // namespaces.
260
+ optional string namespace = 5;
261
+ }
262
+
263
+ // MatchLabels defines a set of labels to match resources against.
264
+ message MatchLabels {
265
+ map<string, string> labels = 1;
266
+ }
267
+
268
+ // ResponseMeta contains metadata pertaining to a RunFunctionResponse.
269
+ message ResponseMeta {
270
+ // An opaque string identifying the content of the request. Must match the
271
+ // meta.tag of the corresponding RunFunctionRequest.
272
+ string tag = 1;
273
+
274
+ // Time-to-live of this response. Crossplane will call the function again when
275
+ // the TTL expires. Crossplane may cache the response to avoid calling the
276
+ // function again until the TTL expires.
277
+ optional google.protobuf.Duration ttl = 2;
278
+ }
279
+
280
+ // State of the XR (XR) and any resources.
281
+ message State {
282
+ // The state of the XR (XR).
283
+ Resource composite = 1;
284
+
285
+ // The state of any other resources. In composition functions these are the
286
+ // composed resources. In operation functions they're arbitrary resources that
287
+ // the operation wants to create or update.
288
+ map<string, Resource> resources = 2;
289
+ }
290
+
291
+ // A Resource represents the state of a Kubernetes resource.
292
+ message Resource {
293
+ // The JSON representation of the resource.
294
+ //
295
+ // * Crossplane will set this field in a RunFunctionRequest to the entire
296
+ // observed state of a resource - including its metadata, spec, and status.
297
+ //
298
+ // * A function should set this field in a RunFunctionRequest to communicate
299
+ // the desired state of the resource.
300
+ //
301
+ // * A function may only specify the desired status of a XR - not its metadata
302
+ // or spec. A function should not return desired metadata or spec for a XR.
303
+ // This will be ignored.
304
+ //
305
+ // * A function may not specify the desired status of any other resource -
306
+ // e.g. composed resources. It may only specify their metadata and spec.
307
+ // Status will be ignored.
308
+ google.protobuf.Struct resource = 1;
309
+
310
+ // The resource's connection details.
311
+ //
312
+ // * Crossplane will set this field in a RunFunctionRequest to communicate the
313
+ // the observed connection details of a composite or composed resource.
314
+ //
315
+ // * A function should set this field in a RunFunctionResponse to indicate the
316
+ // desired connection details of legacy XRs. For modern XRs, this will be ignored.
317
+ //
318
+ // * A function should not set this field in a RunFunctionResponse to indicate
319
+ // the desired connection details of a composed resource. This will be
320
+ // ignored.
321
+ //
322
+ // Connection details are only used for composition. They're ignored by
323
+ // Operations.
324
+ map<string, bytes> connection_details = 2;
325
+
326
+ // Ready indicates whether the resource should be considered ready.
327
+ //
328
+ // * Crossplane will never set this field in a RunFunctionRequest.
329
+ //
330
+ // * A function should set this field to READY_TRUE in a RunFunctionResponse
331
+ // to indicate that a desired resource is ready.
332
+ //
333
+ // * A function should set this field to READY_TRUE in a RunFunctionResponse
334
+ // to indicate that a desired XR is ready. This overwrites the standard
335
+ // readiness detection that determines the ready state of the composite by the
336
+ // ready state of the composed resources.
337
+ //
338
+ // Ready is only used for composition. It's ignored by Operations.
339
+ Ready ready = 3;
340
+ }
341
+
342
+ // Ready indicates whether a resource should be considered ready.
343
+ enum Ready {
344
+ READY_UNSPECIFIED = 0;
345
+
346
+ // True means the resource has been observed to be ready.
347
+ READY_TRUE = 1;
348
+
349
+ // False means the resource has not been observed to be ready.
350
+ READY_FALSE = 2;
351
+ }
352
+
353
+ // A Result of running a function.
354
+ message Result {
355
+ // Severity of this result.
356
+ Severity severity = 1;
357
+
358
+ // Human-readable details about the result.
359
+ string message = 2;
360
+
361
+ // Optional PascalCase, machine-readable reason for this result. If omitted,
362
+ // the value will be ComposeResources.
363
+ optional string reason = 3;
364
+
365
+ // The resources this result targets.
366
+ optional Target target = 4;
367
+ }
368
+
369
+ // Severity of function results.
370
+ enum Severity {
371
+ SEVERITY_UNSPECIFIED = 0;
372
+
373
+ // Fatal results are fatal; subsequent functions may run, but the function
374
+ // pipeline run will be considered a failure and the first fatal result will
375
+ // be returned as an error.
376
+ SEVERITY_FATAL = 1;
377
+
378
+ // Warning results are non-fatal; the entire pipeline will run to completion
379
+ // but warning events and debug logs associated with the XR or Operation will
380
+ // be emitted.
381
+ SEVERITY_WARNING = 2;
382
+
383
+ // Normal results are emitted as normal events and debug logs associated with
384
+ // the XR or operation.
385
+ SEVERITY_NORMAL = 3;
386
+ }
387
+
388
+ // Target of function results and conditions.
389
+ enum Target {
390
+ // If the target is unspecified, the result targets the XR.
391
+ TARGET_UNSPECIFIED = 0;
392
+
393
+ // Target the XR. Results that target the XR should include detailed, advanced
394
+ // information.
395
+ TARGET_COMPOSITE = 1;
396
+
397
+ // Target the XR and the claim. Results that target the XR and the claim
398
+ // should include only end-user friendly information.
399
+ TARGET_COMPOSITE_AND_CLAIM = 2;
400
+ }
401
+
402
+ // Status condition to be applied to the XR. Condition may also optionally be
403
+ // applied to the XR's associated claim. For detailed information on proper
404
+ // usage of status conditions, please see
405
+ // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties.
406
+ message Condition {
407
+ // Type of condition in PascalCase.
408
+ string type = 1;
409
+
410
+ // Status of the condition.
411
+ Status status = 2;
412
+
413
+ // Reason contains a programmatic identifier indicating the reason for the
414
+ // condition's last transition. Producers of specific condition types may
415
+ // define expected values and meanings for this field, and whether the values
416
+ // are considered a guaranteed API. The value should be a PascalCase string.
417
+ // This field may not be empty.
418
+ string reason = 3;
419
+
420
+ // Message is a human readable message indicating details about the
421
+ // transition. This may be an empty string.
422
+ optional string message = 4;
423
+
424
+ // The resources this condition targets.
425
+ optional Target target = 5;
426
+ }
427
+
428
+ enum Status {
429
+ STATUS_CONDITION_UNSPECIFIED = 0;
430
+
431
+ STATUS_CONDITION_UNKNOWN = 1;
432
+
433
+ STATUS_CONDITION_TRUE = 2;
434
+
435
+ STATUS_CONDITION_FALSE = 3;
436
+ }