This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #19 from flanksource/for-each
For_each field
- Loading branch information
Showing
11 changed files
with
420 additions
and
17 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
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
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,16 @@ | ||
apiVersion: abcd.flanksource.com/v1 | ||
kind: ABCD | ||
metadata: | ||
name: test | ||
namespace: default | ||
spec: | ||
topics: | ||
- a | ||
- b | ||
- c | ||
- d | ||
topicsMap: | ||
a1: a2 | ||
b1: b2 | ||
c1: c2 | ||
d1: d2 |
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,89 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: abcds.abcd.flanksource.com | ||
spec: | ||
group: abcd.flanksource.com | ||
names: | ||
kind: ABCD | ||
listKind: ABCDList | ||
plural: abcds | ||
singular: abcd | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
version: v1 | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
validation: | ||
openAPIV3Schema: | ||
description: Schema validation for the ABCD CRDs | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: abcdtopics.abcd.flanksource.com | ||
spec: | ||
group: abcd.flanksource.com | ||
names: | ||
kind: ABCDTopic | ||
listKind: ABCDTopicList | ||
plural: abcdtopics | ||
singular: abcdtopic | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
version: v1 | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
validation: | ||
openAPIV3Schema: | ||
description: Schema validation for the ABCD Topic CRDs | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
--- | ||
apiVersion: templating.flanksource.com/v1 | ||
kind: Template | ||
metadata: | ||
name: abcd-topic | ||
spec: | ||
source: | ||
apiVersion: abcd.flanksource.com/v1 | ||
kind: ABCD | ||
resources: | ||
- forEach: "{{.spec.topics}}" | ||
apiVersion: abcd.flanksource.com/v1 | ||
kind: ABCDTopic | ||
metadata: | ||
name: "{{.metadata.name}}-{{.each}}" | ||
namespace: "{{.metadata.namespace}}" | ||
spec: | ||
topicName: "{{.each}}" | ||
--- | ||
apiVersion: templating.flanksource.com/v1 | ||
kind: Template | ||
metadata: | ||
name: abcd-topic-map | ||
spec: | ||
source: | ||
apiVersion: abcd.flanksource.com/v1 | ||
kind: ABCD | ||
resources: | ||
- forEach: "{{.spec.topicsMap}}" | ||
apiVersion: abcd.flanksource.com/v1 | ||
kind: ABCDTopic | ||
metadata: | ||
name: "{{.metadata.name}}-{{.each.key}}" | ||
namespace: "{{.metadata.namespace}}" | ||
spec: | ||
"{{.each.key}}": "{{.each.value}}" |
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
Oops, something went wrong.