crossplane-function-pythonic 0.4.2__py3-none-any.whl → 0.6.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-pythonic
3
- Version: 0.4.2
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.43.0; extra == 'packages'
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.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
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.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
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
- resource name. The value returned when getting a required resource from BaseComposite is the
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
- ## Single use Composites
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 single use or initialize task?
445
+ just to run that Composition once in a setup or initialize task?
413
446
 
414
- function-pythonic installs a `Composite` CompositeResourceDefinition that enables
415
- creating such tasks using a single Composite resource:
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: pythonic.fn.crossplane.io/v1alpha1
418
- kind: Composite
450
+ apiVersion: inlined.example.org/v1alpha1
451
+ kind: Step
419
452
  metadata:
420
- name: composite-example
453
+ name: inlined-example
421
454
  spec:
422
455
  composite: |
423
456
  class HelloComposite(BaseComposite):
424
457
  def compose(self):
425
- self.status.composite = 'Hello, World!'
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] [--secret-store PATH] [--include-full-xr] [--include-connection-xr]
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
- --secret-store, -s PATH
478
- A YAML file or directory of YAML files specifying Secrets to use to resolve connections and credentials.
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
- ## ConfigMap Packages
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 based python packages are enable using the `--packages` and
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.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
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
 
@@ -0,0 +1,18 @@
1
+ crossplane/pythonic/__about__.py,sha256=v3R2QlL6bK_t2oKW7b96iHro1p7Iag8djZQbp6xQLPE,73
2
+ crossplane/pythonic/__init__.py,sha256=cRk12kc18RLhc9s5dW6sQqZSCEp80fooRO5zxXqc1oA,292
3
+ crossplane/pythonic/__main__.py,sha256=6vYRlYDJtqFgLyiTamnl3htiNOtz8QlDl5WlIP98I8o,31
4
+ crossplane/pythonic/auto_ready.py,sha256=sPetUuJRhwZbg9muaDmbdqmtTIIUDmY4qoadoJA0EtQ,7201
5
+ crossplane/pythonic/command.py,sha256=aT58WBrhU_scaOGeqmsBfofIDnXyW1CQOpCktVGBj5s,4211
6
+ crossplane/pythonic/composite.py,sha256=gQ7DzY0kn8J2lUWH9hYVLZB6NYDBo0IJJwUDBooTNsc,34459
7
+ crossplane/pythonic/function.py,sha256=2f8-J5sgDrtn3z6Fxu2JODnr6VsjBESIVSJ5Hd4LssY,18573
8
+ crossplane/pythonic/grpc.py,sha256=WFyxkIh-nNtOswQhtN1V3e-8Qr79fDcNht8OpvihHYM,5694
9
+ crossplane/pythonic/main.py,sha256=ujUa_FYElQSGqnhZ-0NJrD3kSyYjfRbIp79FV2Yl7hs,599
10
+ crossplane/pythonic/packages.py,sha256=cOlF-wo2CzknwFPAfuwgCiwdT5vDE4n7oBMfQErVzbA,7023
11
+ crossplane/pythonic/protobuf.py,sha256=-HFHlGV1zMi5DmTOxe9qcBMJ0bZKH2hEkJH1CF7nvp4,53128
12
+ crossplane/pythonic/render.py,sha256=qIcUsE6iCka6VwUlhpN1BZhHvbl3GL6X3dPepmdlDV8,33822
13
+ crossplane/pythonic/version.py,sha256=-RiB0p146ayqJj0SXfYxTNv49u9Fx9pPgm59Ji2blhc,214
14
+ crossplane_function_pythonic-0.6.0.dist-info/METADATA,sha256=kaKnXE14jueu5X-kf8k2H904NIg9qV-o4WGOJOaUqqs,36678
15
+ crossplane_function_pythonic-0.6.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
16
+ crossplane_function_pythonic-0.6.0.dist-info/entry_points.txt,sha256=jJ4baywFDviB9WyAhyhNYF2VOCb6XtbRSjKf7bnBwhg,68
17
+ crossplane_function_pythonic-0.6.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
+ crossplane_function_pythonic-0.6.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.28.0
2
+ Generator: hatchling 1.29.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,18 +0,0 @@
1
- crossplane/pythonic/__about__.py,sha256=6nxRspkiSsLkBLqHh-X--3FLozkQy1xfr-6ZG0LORbs,73
2
- crossplane/pythonic/__init__.py,sha256=cRk12kc18RLhc9s5dW6sQqZSCEp80fooRO5zxXqc1oA,292
3
- crossplane/pythonic/__main__.py,sha256=6vYRlYDJtqFgLyiTamnl3htiNOtz8QlDl5WlIP98I8o,31
4
- crossplane/pythonic/auto_ready.py,sha256=sPetUuJRhwZbg9muaDmbdqmtTIIUDmY4qoadoJA0EtQ,7201
5
- crossplane/pythonic/command.py,sha256=aT58WBrhU_scaOGeqmsBfofIDnXyW1CQOpCktVGBj5s,4211
6
- crossplane/pythonic/composite.py,sha256=f9SYjtXVqRx7vse7nQ06Ic6EnnfCYVtpoOmBhR9Jv6g,30451
7
- crossplane/pythonic/function.py,sha256=uILb3XICcWi2JA5W1xuq37nFQA3_TqbdJefo0-gUUNI,18063
8
- crossplane/pythonic/grpc.py,sha256=9ZQceboDju37NB6AhcUSWpBx_hZQ5W7uo7CZF6ynhfI,4451
9
- crossplane/pythonic/main.py,sha256=ujUa_FYElQSGqnhZ-0NJrD3kSyYjfRbIp79FV2Yl7hs,599
10
- crossplane/pythonic/packages.py,sha256=4TxyT6V79R0m4tJbC8R1gwU_vgHGLXKSBzeTTKd8xGo,5120
11
- crossplane/pythonic/protobuf.py,sha256=YcKqH0Y4Vj63m6pUb1ptL4gIKcdNLU-WR8TaQ5eGW-M,52987
12
- crossplane/pythonic/render.py,sha256=e_WQF5TlemfsZim2oGkTPAWuU6BDJztexJ9iBbuFQbo,30417
13
- crossplane/pythonic/version.py,sha256=-RiB0p146ayqJj0SXfYxTNv49u9Fx9pPgm59Ji2blhc,214
14
- crossplane_function_pythonic-0.4.2.dist-info/METADATA,sha256=KemrVxbVM4-B6I1P-Gq3hDdqE67sPMCRyfu9gjBY4_w,31561
15
- crossplane_function_pythonic-0.4.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
- crossplane_function_pythonic-0.4.2.dist-info/entry_points.txt,sha256=jJ4baywFDviB9WyAhyhNYF2VOCb6XtbRSjKf7bnBwhg,68
17
- crossplane_function_pythonic-0.4.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
- crossplane_function_pythonic-0.4.2.dist-info/RECORD,,