Skip to content

Commit

Permalink
simplify random label assignment
Browse files Browse the repository at this point in the history
Signed-off-by: ezgidemirel <[email protected]>
  • Loading branch information
ezgidemirel committed Dec 12, 2023
1 parent 9bbd4e7 commit 8aecb3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions example/filesystem/templates.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ metadata:
gotemplating.fn.crossplane.io/composition-resource-name: test-user-{{ $i }}
labels:
testing.upbound.io/example-name: test-user-{{ $i }}
{{ if or ( eq $.observed.resources nil ) ( eq ( index $.observed.resources ( print "test-user-" $i ) ) nil ) }}
dummy: {{ randomChoice "foo" "bar" "baz" }}
{{ else }}
dummy: {{ ( index $.observed.resources ( print "test-user-" $i ) ).resource.metadata.labels.dummy }}
{{ end }}
dummy: {{ dig "resources" (print "test-user-" $i) "resource" "metadata" "labels" "dummy" ( randomChoice "foo" "bar" "baz" ) $.observed }}
spec:
forProvider: {}
---
Expand Down
6 changes: 1 addition & 5 deletions example/inline/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ spec:
{{ setResourceNameAnnotation (print "test-user-" $i) }}
labels:
testing.upbound.io/example-name: test-user-{{ $i }}
{{ if or ( eq $.observed.resources nil ) ( eq ( index $.observed.resources ( print "test-user-" $i ) ) nil ) }}
dummy: {{ randomChoice "foo" "bar" "baz" }}
{{ else }}
dummy: {{ ( index $.observed.resources ( print "test-user-" $i ) ).resource.metadata.labels.dummy }}
{{ end }}
dummy: {{ dig "resources" (print "test-user-" $i) "resource" "metadata" "labels" "dummy" ( randomChoice "foo" "bar" "baz" ) $.observed }}
spec:
forProvider: {}
---
Expand Down

0 comments on commit 8aecb3b

Please sign in to comment.