Skip to content

Commit 6d30024

Browse files
authored
Merge pull request #351 from haarchri/feature/bump-api-v1
pkg: switch Function package APIs from v1beta1 to v1
2 parents ed50ca7 + bb89eaa commit 6d30024

File tree

34 files changed

+58
-58
lines changed

34 files changed

+58
-58
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
## Introduction
88

9-
Crossplane KCL function allows developers to use [KCL](https://kcl-lang.io/) (a DSL)
10-
to write composite logic without the need for repeated packaging of crossplane functions,
11-
and we support package management and the [KRM KCL specification](https://github.com/kcl-lang/krm-kcl),
9+
Crossplane KCL function allows developers to use [KCL](https://kcl-lang.io/) (a DSL)
10+
to write composite logic without the need for repeated packaging of crossplane functions,
11+
and we support package management and the [KRM KCL specification](https://github.com/kcl-lang/krm-kcl),
1212
which allows for OCI/Git source and the reuse of [KCL's module ecosystem](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1).
1313

14-
Check out these following blogs to learn more.
14+
Check out these following blogs to learn more.
1515

1616
+ [Using KCL Programming Language to Write Crossplane Composition Functions](https://blog.crossplane.io/function-kcl/)
1717
+ [KCL: The Game-Changer for Crossplane Composition Building](https://blog.upbound.io/kcl-benefits-crossplane-composition-building)
@@ -64,7 +64,7 @@ spec:
6464
6565
```yaml
6666
cat <<EOF | kubectl apply -f -
67-
apiVersion: pkg.crossplane.io/v1beta1
67+
apiVersion: pkg.crossplane.io/v1
6868
kind: Function
6969
metadata:
7070
name: kcl-function
@@ -135,7 +135,7 @@ This `ConfigMap` will be mounted to the function pod and the templates will be a
135135

136136
```yaml
137137
---
138-
apiVersion: pkg.crossplane.io/v1beta1
138+
apiVersion: pkg.crossplane.io/v1
139139
kind: Function
140140
metadata:
141141
name: function-kcl
@@ -168,7 +168,7 @@ spec:
168168

169169
### Use as a Base Image
170170

171-
This function can also be used as a base image to build complex functions in KCL.
171+
This function can also be used as a base image to build complex functions in KCL.
172172
To do this, add your KCL code to the image and set the `FUNCTION_KCL_DEFAULT_SOURCE` environment variable to the path where you put your code.
173173

174174
For example, if you have the following in `main.k`:
@@ -414,7 +414,7 @@ spec:
414414
```
415415

416416
> [!NOTE]
417-
> When returning multiple resources, we need to set different `metadata.name` or `metadata.annotations."krm.kcl.dev/composition-resource-name" `
417+
> When returning multiple resources, we need to set different `metadata.name` or `metadata.annotations."krm.kcl.dev/composition-resource-name" `
418418
> to distinguish between different resources in the composition functions.
419419

420420
### Target Support
@@ -442,9 +442,9 @@ spec:
442442

443443
### Extract Data from a Specific Composed Resource
444444

445-
To extract data from a specific composed resource by using the resource name, we can use the `option("params").ocds` variable,
446-
`ocds` is a mapping that its key is the resource name and its value is
447-
the [`observed composed resource`](https://pkg.go.dev/github.com/crossplane/[email protected]/resource#ObservedComposed)
445+
To extract data from a specific composed resource by using the resource name, we can use the `option("params").ocds` variable,
446+
`ocds` is a mapping that its key is the resource name and its value is
447+
the [`observed composed resource`](https://pkg.go.dev/github.com/crossplane/[email protected]/resource#ObservedComposed)
448448
like [the example](./examples/default/read_ocds_resource/composition.yaml).
449449

450450
```yaml
@@ -463,7 +463,7 @@ spec:
463463

464464
### Composite Resource Connection Details
465465

466-
To return desired composite resource connection details, include a KCL config that produces the special CompositeConnectionDetails resource
466+
To return desired composite resource connection details, include a KCL config that produces the special CompositeConnectionDetails resource
467467
like [the example](./examples/default/connection_details/composition.yaml):
468468

469469
```yaml
@@ -489,8 +489,8 @@ spec:
489489
```
490490

491491
> [!NOTE]
492-
> The value of the connection secret value must be base64 encoded.
493-
> This is already the case if you are referencing a key from a managed resource's connectionDetails field.
492+
> The value of the connection secret value must be base64 encoded.
493+
> This is already the case if you are referencing a key from a managed resource's connectionDetails field.
494494
> However, if you want to include a connection secret value from somewhere else, you will need to use the `base64.encode` function:
495495

496496
```yaml
@@ -530,14 +530,14 @@ spec:
530530
```
531531

532532
### Extra resources
533-
By defining one or more special `ExtraResources`, you can ask Crossplane to retrieve additional resources from the local cluster
534-
and make them available to your templates.
533+
By defining one or more special `ExtraResources`, you can ask Crossplane to retrieve additional resources from the local cluster
534+
and make them available to your templates.
535535
See the [docs](https://github.com/crossplane/crossplane/blob/main/design/design-doc-composition-functions-extra-resources.md) for more information.
536536

537537
> [!NOTE]
538538
> With ExtraResources, you can fetch cluster-scoped resources, but not namespaced resources such as claims.
539539
> If you need to get a composite resource via its claim name you can use `matchLabels` with `crossplane.io/claim-name: <claimname>`.
540-
> Namespace scoped resources can be queried with the `matchNamespace` field.
540+
> Namespace scoped resources can be queried with the `matchNamespace` field.
541541
> Leaving the `matchNamespace` field empty or not defining it will query a cluster scoped resource.
542542

543543
```yaml
@@ -627,7 +627,7 @@ kind: KCLInput
627627
spec:
628628
source: |
629629
er = option("params")?.extraResources
630-
630+
631631
if er?.bar:
632632
name = er?.bar[0]?.Resource?.metadata?.name or ""
633633
# Omit other logic
@@ -666,11 +666,11 @@ metadata:
666666
spec:
667667
source: |
668668
oxr = option("params").oxr
669-
669+
670670
dxr = {
671671
**oxr
672672
}
673-
673+
674674
conditions = {
675675
apiVersion: "meta.krm.kcl.dev/v1alpha1"
676676
kind: "Conditions"
@@ -687,16 +687,16 @@ spec:
687687
}
688688
]
689689
}
690-
690+
691691
items = [
692692
conditions
693693
dxr
694694
]
695695
```
696696

697-
- **target**: Specifies whether the condition should be present in the composite resource or both the composite and claim resources.
697+
- **target**: Specifies whether the condition should be present in the composite resource or both the composite and claim resources.
698698
Possible values are `CompositeAndClaim` and `Composite`
699-
- **force**: Forces the overwrite of existing conditions. If a condition with the same `type` already exists, it will not be overwritten by default.
699+
- **force**: Forces the overwrite of existing conditions. If a condition with the same `type` already exists, it will not be overwritten by default.
700700
Setting force to `True` will overwrite the first condition.
701701

702702
You can also set events as follows:
@@ -710,11 +710,11 @@ metadata:
710710
spec:
711711
source: |
712712
oxr = option("params").oxr
713-
713+
714714
dxr = {
715715
**oxr
716716
}
717-
717+
718718
events = {
719719
apiVersion: "meta.krm.kcl.dev/v1alpha1"
720720
kind: "Events"

examples/default/conditions/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/connection_details/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/context/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/debug_print/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/dependencies/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/events/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/external_deps/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/extra_resources/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

examples/default/extra_resources_namespaced/functions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: pkg.crossplane.io/v1beta1
1+
apiVersion: pkg.crossplane.io/v1
22
kind: Function
33
metadata:
44
name: kcl-function

0 commit comments

Comments
 (0)