Skip to content

Commit

Permalink
chore: update local path examples
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Mar 14, 2024
1 parent 16a3743 commit 063e71f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/resources/network/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
run:
crossplane beta render xr.yaml composition.yaml functions.yaml -r

oci:
crossplane beta render xr.yaml oci_composition.yaml functions.yaml -r

git:
crossplane beta render xr.yaml git_composition.yaml functions.yaml -r

local:
crossplane beta render xr.yaml local_composition.yaml functions.yaml -r
27 changes: 27 additions & 0 deletions examples/resources/network/composition.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Get the XR spec fields
id = option("params")?.oxr?.spec.id or ""
# Render XR to crossplane managed resources
network_id_labels = {"networks.meta.fn.crossplane.io/network-id" = id} if id else {}
vpc = {
apiVersion = "ec2.aws.upbound.io/v1beta1"
kind = "VPC"
metadata.name = "vpc"
metadata.labels: network_id_labels
spec.forProvider = {
region = "eu-west-1"
cidrBlock = "192.168.0.0/16"
enableDnsSupport = True
enableDnsHostnames = True
}
}
gateway = {
apiVersion = "ec2.aws.upbound.io/v1beta1"
kind = "InternetGateway"
metadata.name = "gateway"
metadata.labels: network_id_labels
spec.forProvider = {
region = "eu-west-1"
vpcIdSelector.matchControllerRef = True
}
}
items = [vpc, gateway]
24 changes: 24 additions & 0 deletions examples/resources/network/local_composition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xlabels.fn-demo.crossplane.io
labels:
provider: aws
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: fn-demo.crossplane.io/v1alpha1
kind: XNetwork
mode: Pipeline
pipeline:
- step: normal
functionRef:
name: kcl-function
input:
apiVersion: krm.kcl.dev/v1alpha1
kind: KCLRun
metadata:
name: basic
spec:
target: Resources
source: ./examples/resources/network/composition.k

0 comments on commit 063e71f

Please sign in to comment.