crossplane-function-pythonic 0.1.0__tar.gz → 0.1.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 (126) hide show
  1. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/PKG-INFO +4 -4
  2. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/README.md +3 -3
  3. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/composite.py +4 -26
  4. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/main.py +8 -8
  5. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/.dev/functions.yaml +1 -1
  6. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/cluster-function-pythonic.yaml +1 -1
  7. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/functions.yaml +1 -1
  8. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/functions.yaml +1 -1
  9. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/function.yaml +1 -1
  10. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/context → crossplane_function_pythonic-0.1.2/examples/function-go-templating/conditions}/functions.yaml +1 -1
  11. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/conditions → crossplane_function_pythonic-0.1.2/examples/function-go-templating/context}/functions.yaml +1 -1
  12. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/recursive → crossplane_function_pythonic-0.1.2/examples/function-go-templating/extra-resources}/functions.yaml +1 -1
  13. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/getComposedResource → crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/fromYaml}/functions.yaml +1 -1
  14. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/getCompositeResource → crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/getComposedResource}/functions.yaml +1 -1
  15. {crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/fromYaml → crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/getCompositeResource}/functions.yaml +1 -1
  16. crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/getResourceCondition/functions.yaml +9 -0
  17. crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/include/functions.yaml +9 -0
  18. crossplane_function_pythonic-0.1.2/examples/function-go-templating/functions/toYaml/functions.yaml +9 -0
  19. crossplane_function_pythonic-0.1.2/examples/function-go-templating/inline/functions.yaml +9 -0
  20. crossplane_function_pythonic-0.1.2/examples/function-go-templating/recursive/functions.yaml +9 -0
  21. {crossplane_function_pythonic-0.1.0/examples/helm-copy-secret → crossplane_function_pythonic-0.1.2/examples/get-started-app}/functions.yaml +1 -1
  22. {crossplane_function_pythonic-0.1.0/examples/single-purpose → crossplane_function_pythonic-0.1.2/examples/helm-copy-secret}/functions.yaml +1 -1
  23. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/README.md +35 -0
  24. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/composition.yaml +73 -0
  25. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/definition.yaml +39 -0
  26. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/functions.yaml +8 -0
  27. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/observed.yaml +6 -0
  28. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/provider-ec2.yaml +20 -0
  29. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/render.sh +4 -0
  30. crossplane_function_pythonic-0.1.2/examples/import-existing-vpc/xr.yaml +10 -0
  31. {crossplane_function_pythonic-0.1.0/examples/get-started-app → crossplane_function_pythonic-0.1.2/examples/single-purpose}/functions.yaml +1 -1
  32. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/single-purpose/xr.yaml +1 -0
  33. crossplane_function_pythonic-0.1.2/examples/usages-extra/functions.yaml +9 -0
  34. crossplane_function_pythonic-0.1.0/examples/function-go-templating/extra-resources/functions.yaml +0 -9
  35. crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/getResourceCondition/functions.yaml +0 -9
  36. crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/include/functions.yaml +0 -9
  37. crossplane_function_pythonic-0.1.0/examples/function-go-templating/functions/toYaml/functions.yaml +0 -9
  38. crossplane_function_pythonic-0.1.0/examples/function-go-templating/inline/functions.yaml +0 -9
  39. crossplane_function_pythonic-0.1.0/examples/usages-extra/functions.yaml +0 -9
  40. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/.gitignore +0 -0
  41. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/LICENSE +0 -0
  42. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/__init__.py +0 -0
  43. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/function.py +0 -0
  44. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/packages.py +0 -0
  45. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/crossplane/pythonic/protobuf.py +0 -0
  46. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/README.md +0 -0
  47. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/aks/kubernetescluster.py +0 -0
  48. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/aks/resourcegroup.py +0 -0
  49. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/composition.yaml +0 -0
  50. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/definition.yaml +0 -0
  51. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/install.sh +0 -0
  52. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/kustomization.yaml +0 -0
  53. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/providers.yaml +0 -0
  54. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/render.sh +0 -0
  55. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/aks-cluster/xr.yaml +0 -0
  56. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/composition-v2.yaml +0 -0
  57. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/composition.yaml +0 -0
  58. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/definition.yaml +0 -0
  59. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/render-v2.sh +0 -0
  60. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/render.sh +0 -0
  61. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/eks-cluster/xr.yaml +0 -0
  62. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/README.md +0 -0
  63. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/composition.yaml +0 -0
  64. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/definition.yaml +0 -0
  65. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/kustomization.yaml +0 -0
  66. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/runtime.yaml +0 -0
  67. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/vcluster.py +0 -0
  68. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/filing-system/vcluster.yaml +0 -0
  69. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/conditions/composition.yaml +0 -0
  70. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/conditions/render.sh +0 -0
  71. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/conditions/xr.yaml +0 -0
  72. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/conditions/xrd.yaml +0 -0
  73. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/context/composition.yaml +0 -0
  74. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/context/environmentConfigs.yaml +0 -0
  75. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/context/render.sh +0 -0
  76. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/context/xr.yaml +0 -0
  77. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/context/xrd.yaml +0 -0
  78. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/extra-resources/composition.yaml +0 -0
  79. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/extra-resources/extraResources.yaml +0 -0
  80. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/extra-resources/render.sh +0 -0
  81. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/extra-resources/xr.yaml +0 -0
  82. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/fromYaml/composition.yaml +0 -0
  83. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/fromYaml/render.sh +0 -0
  84. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/fromYaml/xr.yaml +0 -0
  85. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getComposedResource/composition.yaml +0 -0
  86. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getComposedResource/observed.yaml +0 -0
  87. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getComposedResource/render.sh +0 -0
  88. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getComposedResource/xr.yaml +0 -0
  89. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getCompositeResource/composition.yaml +0 -0
  90. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getCompositeResource/render.sh +0 -0
  91. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getCompositeResource/xr.yaml +0 -0
  92. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getResourceCondition/composition.yaml +0 -0
  93. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getResourceCondition/observed.yaml +0 -0
  94. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getResourceCondition/render.sh +0 -0
  95. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/getResourceCondition/xr.yaml +0 -0
  96. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/include/composition.yaml +0 -0
  97. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/include/render.sh +0 -0
  98. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/include/xr.yaml +0 -0
  99. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/toYaml/composition.yaml +0 -0
  100. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/toYaml/render.sh +0 -0
  101. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/functions/toYaml/xr.yaml +0 -0
  102. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/inline/composition.yaml +0 -0
  103. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/inline/render.sh +0 -0
  104. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/inline/xr.yaml +0 -0
  105. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/recursive/composition-real.yaml +0 -0
  106. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/recursive/composition-wrapper.yaml +0 -0
  107. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/recursive/render.sh +0 -0
  108. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/function-go-templating/recursive/xr.yaml +0 -0
  109. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/get-started-app/composition.yaml +0 -0
  110. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/get-started-app/definition.yaml +0 -0
  111. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/get-started-app/render.sh +0 -0
  112. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/get-started-app/xr.yaml +0 -0
  113. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/composition.yaml +0 -0
  114. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/kustomization.yaml +0 -0
  115. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/render.sh +0 -0
  116. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/run-function.sh +0 -0
  117. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/vcluster.py +0 -0
  118. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/xr.yaml +0 -0
  119. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/helm-copy-secret/xrd.yaml +0 -0
  120. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/single-purpose/render.sh +0 -0
  121. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/usages-extra/composition.yaml +0 -0
  122. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/usages-extra/extraResources.yaml +0 -0
  123. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/usages-extra/observedResources.yaml +0 -0
  124. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/usages-extra/render.sh +0 -0
  125. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/examples/usages-extra/xr.yaml +0 -0
  126. {crossplane_function_pythonic-0.1.0 → crossplane_function_pythonic-0.1.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-pythonic
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A Python centric Crossplane Function
5
5
  Project-URL: Documentation, https://github.com/fortra/function-pythonic#readme
6
6
  Project-URL: Issues, https://github.com/fortra/function-pythonic/issues
@@ -81,7 +81,7 @@ kind: Function
81
81
  metadata:
82
82
  name: function-pythonic
83
83
  spec:
84
- package: ghcr.io/fortra/function-pythonic:v0.0.10
84
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
85
85
  ```
86
86
  ## Composed Resource Dependencies
87
87
 
@@ -408,7 +408,7 @@ metadata:
408
408
  annotations:
409
409
  render.crossplane.io/runtime: Development
410
410
  spec:
411
- package: ghcr.io/fortra/function-pythonic:v0.0.10
411
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
412
412
  ```
413
413
  In one terminal session, run function-pythonic:
414
414
  ```shell
@@ -510,7 +510,7 @@ kind: Function
510
510
  metadata:
511
511
  name: function-pythonic
512
512
  spec:
513
- package: ghcr.io/fortra/function-pythonic:v0.0.10
513
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
514
514
  runtimeConfigRef:
515
515
  name: function-pythonic
516
516
  ---
@@ -57,7 +57,7 @@ kind: Function
57
57
  metadata:
58
58
  name: function-pythonic
59
59
  spec:
60
- package: ghcr.io/fortra/function-pythonic:v0.0.10
60
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
61
61
  ```
62
62
  ## Composed Resource Dependencies
63
63
 
@@ -384,7 +384,7 @@ metadata:
384
384
  annotations:
385
385
  render.crossplane.io/runtime: Development
386
386
  spec:
387
- package: ghcr.io/fortra/function-pythonic:v0.0.10
387
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
388
388
  ```
389
389
  In one terminal session, run function-pythonic:
390
390
  ```shell
@@ -486,7 +486,7 @@ kind: Function
486
486
  metadata:
487
487
  name: function-pythonic
488
488
  spec:
489
- package: ghcr.io/fortra/function-pythonic:v0.0.10
489
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
490
490
  runtimeConfigRef:
491
491
  name: function-pythonic
492
492
  ---
@@ -41,7 +41,7 @@ class BaseComposite:
41
41
  self.kind = self.observed.kind
42
42
  self.metadata = self.observed.metadata
43
43
  self.spec = self.observed.spec
44
- self.status = Status(self.observed.status, self.desired.status)
44
+ self.status = self.desired.status
45
45
  self.conditions = Conditions(observed, self.response)
46
46
  self.connection = Connection(observed, desired)
47
47
  self.events = Events(self.response)
@@ -217,10 +217,9 @@ class Resource:
217
217
 
218
218
  @property
219
219
  def externalName(self):
220
- name = self.metadata.annotations['crossplane.io/external-name']
221
- if name is None:
222
- name = self.observed.metadata.annotations['crossplane.io/external-name']
223
- return name
220
+ if 'crossplane.io/external-name' in self.metadata.annotations:
221
+ return self.metadata.annotations['crossplane.io/external-name']
222
+ return self.observed.metadata.annotations['crossplane.io/external-name']
224
223
 
225
224
  @externalName.setter
226
225
  def externalName(self, name):
@@ -409,27 +408,6 @@ class RequiredResource:
409
408
  return bool(self.observed)
410
409
 
411
410
 
412
- class Status:
413
- def __init__(self, observed, desired):
414
- self.__dict__['_observed'] = observed
415
- self.__dict__['_desired'] = desired
416
-
417
- def __getattr__(self, key):
418
- return self[key]
419
-
420
- def __getitem__(self, key):
421
- value = self._desired[key]
422
- if value is None:
423
- value = self._observed[key]
424
- return value
425
-
426
- def __setattr__(self, key, value):
427
- self[key] = value
428
-
429
- def __setitem__(self, key, value):
430
- self._desired[key] = value
431
-
432
-
433
411
  class Conditions:
434
412
  def __init__(self, observed, response=None):
435
413
  self._observed = observed
@@ -102,13 +102,6 @@ class Main:
102
102
  print('Either --tls-certs-dir or --insecure must be specified', file=sys.stderr)
103
103
  sys.exit(1)
104
104
 
105
- self.configure_logging(args)
106
- # enables read only volumes or mismatched uid volumes
107
- sys.dont_write_bytecode = True
108
- await self.run(args)
109
-
110
- # Allow for independent running of function-pythonic
111
- async def run(self, args):
112
105
  if args.pip_install:
113
106
  import pip._internal.cli.main
114
107
  pip._internal.cli.main.main(['install', '--user', *shlex.split(args.pip_install)])
@@ -116,6 +109,13 @@ class Main:
116
109
  for path in reversed(args.python_path):
117
110
  sys.path.insert(0, str(pathlib.Path(path).expanduser().resolve()))
118
111
 
112
+ self.configure_logging(args)
113
+ # enables read only volumes or mismatched uid volumes
114
+ sys.dont_write_bytecode = True
115
+ await self.run(args)
116
+
117
+ # Allow for independent running of function-pythonic
118
+ async def run(self, args):
119
119
  if args.allow_oversize_protos:
120
120
  from google.protobuf.internal import api_implementation
121
121
  if api_implementation._c_module:
@@ -166,7 +166,7 @@ class Main:
166
166
  handler = logging.StreamHandler()
167
167
  handler.setFormatter(formatter)
168
168
  logger = logging.getLogger()
169
- logger.addHandler(handler)
169
+ logger.handlers = [handler]
170
170
  logger.setLevel(logging.DEBUG if args.debug else logging.INFO)
171
171
 
172
172
 
@@ -10,4 +10,4 @@ metadata:
10
10
  render.crossplane.io/runtime: Development
11
11
  render.crossplane.io/runtime-development-target: localhost:9443
12
12
  spec:
13
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
13
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -3,7 +3,7 @@ kind: Function
3
3
  metadata:
4
4
  name: function-pythonic
5
5
  spec:
6
- package: ghcr.io/fortra/function-pythonic:v0.0.11
6
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
7
7
  runtimeConfigRef:
8
8
  name: function-pythonic
9
9
  ---
@@ -5,6 +5,6 @@ metadata:
5
5
  annotations:
6
6
  render.crossplane.io/runtime: Development
7
7
  spec:
8
- package: ghcr.io/fortra/function-pythonic:v0.0.11
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
9
9
  runtimeConfigRef:
10
10
  name: function-pythonic
@@ -5,4 +5,4 @@ metadata:
5
5
  annotations:
6
6
  render.crossplane.io/runtime: Development
7
7
  spec:
8
- package: ghcr.io/fortra/function-pythonic:v0.0.10
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -3,7 +3,7 @@ kind: Function
3
3
  metadata:
4
4
  name: function-pythonic
5
5
  spec:
6
- package: ghcr.io/fortra/function-pythonic:v0.0.10
6
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
7
7
  runtimeConfigRef:
8
8
  apiVersion: pkg.crossplane.io/v1beta1
9
9
  kind: DeploymentRuntimeConfig
@@ -15,7 +15,7 @@ metadata:
15
15
  # This tells crossplane beta render to connect to the function locally.
16
16
  render.crossplane.io/runtime: Development
17
17
  spec:
18
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
18
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
19
19
  ---
20
20
  apiVersion: pkg.crossplane.io/v1beta1
21
21
  kind: Function
@@ -15,7 +15,7 @@ metadata:
15
15
  # This tells crossplane beta render to connect to the function locally.
16
16
  render.crossplane.io/runtime: Development
17
17
  spec:
18
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
18
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
19
19
  ---
20
20
  apiVersion: pkg.crossplane.io/v1beta1
21
21
  kind: Function
@@ -6,4 +6,4 @@ metadata:
6
6
  # This tells crossplane beta render to connect to the function locally.
7
7
  render.crossplane.io/runtime: Development
8
8
  spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonicv0.1.0
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -6,4 +6,4 @@ metadata:
6
6
  # This tells crossplane beta render to connect to the function locally.
7
7
  render.crossplane.io/runtime: Development
8
8
  spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -6,4 +6,4 @@ metadata:
6
6
  # This tells crossplane beta render to connect to the function locally.
7
7
  render.crossplane.io/runtime: Development
8
8
  spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -6,4 +6,4 @@ metadata:
6
6
  # This tells crossplane beta render to connect to the function locally.
7
7
  render.crossplane.io/runtime: Development
8
8
  spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -5,4 +5,4 @@ metadata:
5
5
  annotations:
6
6
  render.crossplane.io/runtime: Development
7
7
  spec:
8
- package: ghcr.io/fortra/function-pythonic:v0.0.10
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -5,4 +5,4 @@ metadata:
5
5
  annotations:
6
6
  render.crossplane.io/runtime: Development
7
7
  spec:
8
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,35 @@
1
+ # Import Existing VPC
2
+
3
+ This example demonstrates how to dynamically detect and importing
4
+ existing external resources when the external name of that resource
5
+ is a name generated by the external backend.
6
+
7
+ function-pythonic is deployed using `--pip-install` command line
8
+ option to install the AWS python client and must be configured
9
+ with the needed AWS permissions.
10
+
11
+ Here is an example of a DeploymentRuntimeConfig that uses the
12
+ `function-pythonic` ServiceAccount name which is configured
13
+ with needed EKS Pod Identity AWS permissions:
14
+ ```yaml
15
+ apiVersion: pkg.crossplane.io/v1beta1
16
+ kind: DeploymentRuntimeConfig
17
+ metadata:
18
+ name: function-pythonic
19
+ spec:
20
+ deploymentTemplate:
21
+ spec:
22
+ template:
23
+ spec:
24
+ containers:
25
+ - name: package-runtime
26
+ args:
27
+ - --debug
28
+ - --pip-install
29
+ - --quiet aiobotocore==2.23.2
30
+ serviceAccountName: function-pythonic
31
+ ```
32
+ To run the `render.sh` script, ensure that aiobotocore is installed
33
+ in the python environment used. The default AWS profile will be used
34
+ unless the AWS_PROFILE environment variable is set, or other
35
+ appropriate AWS environment variables.
@@ -0,0 +1,73 @@
1
+ apiVersion: apiextensions.crossplane.io/v1
2
+ kind: Composition
3
+ metadata:
4
+ name: networks.caleb.pythonic.com
5
+ spec:
6
+ compositeTypeRef:
7
+ apiVersion: caleb.pythonic.com/v1alpha1
8
+ kind: Network
9
+ mode: Pipeline
10
+ pipeline:
11
+
12
+ - step: render-templates
13
+ functionRef:
14
+ name: function-pythonic
15
+ input:
16
+ apiVersion: pythonic.fn.fortra.com/v1alpha1
17
+ kind: Composite
18
+ composite: |
19
+ from crossplane.pythonic import BaseComposite
20
+ from aiobotocore.session import get_session
21
+
22
+ class NetworkComposite(BaseComposite):
23
+ async def compose(self):
24
+ # Only create the AWS Session if needed
25
+ self._aws_session = None
26
+ # Create/Get VPC
27
+ vpc = await self.compose_vpc()
28
+
29
+ async def compose_vpc(self):
30
+ vpc = self.resources.VPC('ec2.aws.m.upbound.io/v1beta1', 'VPC')
31
+ vpc.spec.forProvider(
32
+ region = self.spec.region,
33
+ cidrBlock = self.spec.cidr,
34
+ enableDnsHostnames = True,
35
+ enableDnsSupport = True,
36
+ tags = self.tags(Name=self.metadata.name),
37
+ )
38
+ if not vpc.externalName:
39
+ async with self.aws_client('ec2') as ec2:
40
+ vpcs = (await ec2.describe_vpcs(
41
+ Filters=[{
42
+ 'Name': 'tag:Name',
43
+ 'Values': [str(self.metadata.name)],
44
+ }],
45
+ ))['Vpcs']
46
+ if vpcs:
47
+ if len(vpcs) == 1:
48
+ vpc.externalName = vpcs[0]['VpcId']
49
+ else:
50
+ self.events.fatal('MultipleResources', f"More than one vpc found for: {self.metadata.name}")
51
+ self.status.vpcId = vpc.status.atProvider.id
52
+ return vpc
53
+
54
+ def aws_client(self, service):
55
+ if not self._aws_session:
56
+ self._aws_session = get_session()
57
+ self._aws_clients = {}
58
+ client = self._aws_clients.get(service)
59
+ if not client:
60
+ client = self._aws_session.create_client(service, str(self.spec.region))
61
+ self._aws_clients[service] = client
62
+ return client
63
+
64
+ def tags(self, *args, **kwargs):
65
+ tags = {}
66
+ for arg in args:
67
+ arg = arg.split('=', 1)
68
+ tags[arg[0].strip()] = arg[1].lstrip()
69
+ tags.update(kwargs)
70
+ if self.spec.tags:
71
+ for key, value in self.spec.tags:
72
+ tags[key] = value
73
+ return tags
@@ -0,0 +1,39 @@
1
+ apiVersion: apiextensions.crossplane.io/v2
2
+ kind: CompositeResourceDefinition
3
+ metadata:
4
+ name: networks.caleb.pythonic.com
5
+ spec:
6
+ group: caleb.pythonic.com
7
+ names:
8
+ kind: Network
9
+ plural: networks
10
+ defaultCompositionRef:
11
+ name: networks.caleb.pythonic.com
12
+ versions:
13
+ - name: v1alpha1
14
+ served: true
15
+ referenceable: true
16
+ schema:
17
+ openAPIV3Schema:
18
+ type: object
19
+ properties:
20
+ spec:
21
+ type: object
22
+ properties:
23
+ region:
24
+ type: string
25
+ cidr:
26
+ type: string
27
+ tags:
28
+ type: object
29
+ additionalProperties:
30
+ type: string
31
+ default: {}
32
+ required:
33
+ - region
34
+ - cidr
35
+ status:
36
+ type: object
37
+ properties:
38
+ vpcId:
39
+ type: string
@@ -0,0 +1,8 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ render.crossplane.io/runtime: Development
7
+ spec:
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -0,0 +1,6 @@
1
+ apiVersion: ec2.aws.m.upbound.io/v1beta1
2
+ kind: VPC
3
+ metadata:
4
+ annotations:
5
+ crossplane.io/composition-resource-name: VPC
6
+ crossplane.io/external-name: vpc-0123456789
@@ -0,0 +1,20 @@
1
+ apiVersion: pkg.crossplane.io/v1
2
+ kind: Provider
3
+ metadata:
4
+ name: aws-upbound-provider-ec2
5
+ spec:
6
+ package: xpkg.upbound.io/upbound/provider-aws-ec2:v2.1.0
7
+ runtimeConfigRef:
8
+ name: provider-aws-upbound
9
+ ---
10
+ apiVersion: aws.m.upbound.io/v1beta1
11
+ kind: ClusterProviderConfig
12
+ metadata:
13
+ name: default
14
+ spec:
15
+ credentials:
16
+ secretRef:
17
+ key: credentials
18
+ name: aws-credentials
19
+ namespace: crossplane-system
20
+ source: Secret
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ cd $(dirname $(realpath $0))
3
+ #exec crossplane render xr.yaml composition.yaml functions.yaml
4
+ exec crossplane render --observed-resources=observed.yaml xr.yaml composition.yaml functions.yaml
@@ -0,0 +1,10 @@
1
+ apiVersion: caleb.pythonic.com/v1alpha1
2
+ kind: Network
3
+ metadata:
4
+ namespace: crossplane-system
5
+ name: test-network
6
+ spec:
7
+ region: us-east-1
8
+ cidr: 10.0.0.0/16
9
+ tags:
10
+ 'fortra:cloudops': 'owned'
@@ -5,4 +5,4 @@ metadata:
5
5
  annotations:
6
6
  render.crossplane.io/runtime: Development
7
7
  spec:
8
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
8
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -6,4 +6,5 @@ spec:
6
6
  composite: |
7
7
  class Composite(BaseComposite):
8
8
  def compose(self):
9
+ self.logger.info('Debug World!')
9
10
  self.status.composite = 'Hello, World!'
@@ -0,0 +1,9 @@
1
+ apiVersion: pkg.crossplane.io/v1beta1
2
+ kind: Function
3
+ metadata:
4
+ name: function-pythonic
5
+ annotations:
6
+ # This tells crossplane beta render to connect to the function locally.
7
+ render.crossplane.io/runtime: Development
8
+ spec:
9
+ package: ghcr.io/fortra/function-pythonic:v0.1.2
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0
@@ -1,9 +0,0 @@
1
- apiVersion: pkg.crossplane.io/v1beta1
2
- kind: Function
3
- metadata:
4
- name: function-pythonic
5
- annotations:
6
- # This tells crossplane beta render to connect to the function locally.
7
- render.crossplane.io/runtime: Development
8
- spec:
9
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.1.0