generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ezgidemirel/add-cm-example
Add 'templates.tmpl' file and update filesystem example README
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
# The `FileSystem` source | ||
|
||
You can't run the example in this directory using `crossplane beta render` | ||
because it loads templates from a ConfigMap. See `functions.yaml` for details. | ||
because it loads templates from a ConfigMap. | ||
|
||
You can create a ConfigMap with the templates using the following command: | ||
|
||
```shell | ||
kubectl create configmap templates --from-file=templates.tmpl -n crossplane-system | ||
``` | ||
|
||
This ConfigMap will be mounted to the function pod and the templates will be | ||
available in the `/templates` directory. Please see `functions.yaml` for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- range $i := until ( .observed.composite.resource.spec.count | int ) }} | ||
--- | ||
apiVersion: iam.aws.upbound.io/v1beta1 | ||
kind: User | ||
metadata: | ||
annotations: | ||
gotemplating.fn.crossplane.io/composition-resource-name: test-user-{{ $i }} | ||
labels: | ||
testing.upbound.io/example-name: test-user-{{ $i }} | ||
{{ if eq $.observed.resources nil }} | ||
dummy: {{ randomChoice "foo" "bar" "baz" }} | ||
{{ else }} | ||
dummy: {{ ( index $.observed.resources ( print "test-user-" $i ) ).resource.metadata.labels.dummy }} | ||
{{ end }} | ||
spec: | ||
forProvider: {} | ||
--- | ||
apiVersion: iam.aws.upbound.io/v1beta1 | ||
kind: AccessKey | ||
metadata: | ||
annotations: | ||
gotemplating.fn.crossplane.io/composition-resource-name: sample-access-key-{{ $i }} | ||
spec: | ||
forProvider: | ||
userSelector: | ||
matchLabels: | ||
testing.upbound.io/example-name: test-user-{{ $i }} | ||
writeConnectionSecretToRef: | ||
name: sample-access-key-secret-{{ $i }} | ||
namespace: crossplane-system | ||
{{- end }} | ||
--- | ||
apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1 | ||
kind: CompositeConnectionDetails | ||
{{ if eq $.observed.resources nil }} | ||
data: {} | ||
{{ else }} | ||
data: | ||
username: {{ ( index $.observed.resources "sample-access-key-0" ).connectionDetails.username }} | ||
password: {{ ( index $.observed.resources "sample-access-key-0" ).connectionDetails.password }} | ||
url: {{ "http://www.example.com" | b64enc }} | ||
{{ end }} | ||
--- | ||
apiVersion: aws.platformref.upbound.io/v1alpha1 | ||
kind: XUser | ||
status: | ||
dummy: cool-status |