File tree Expand file tree Collapse file tree 5 files changed +78
-1
lines changed Expand file tree Collapse file tree 5 files changed +78
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import (
8
8
9
9
// // ©itOpsSetTemplate describes a resource to create
10
10
type GitOpsSetTemplate struct {
11
- Repeat string `json:"repeat,omitempty"`
11
+ // Repeat is a JSONPath string defining that the template content should be
12
+ // repeated for each of the matching elements in the JSONPath expression.
13
+ // https://kubernetes.io/docs/reference/kubectl/jsonpath/
14
+ Repeat string `json:"repeat,omitempty"`
15
+ // Content is the YAML to be templated and generated.
12
16
Content runtime.RawExtension `json:"content"`
13
17
}
14
18
@@ -19,6 +23,7 @@ type ListGenerator struct {
19
23
20
24
// GitRepositoryGeneratorFileItemm defines a path to a file to be parsed when generating.
21
25
type GitRepositoryGeneratorFileItem struct {
26
+ // Path is the name of a file to read and generate from can be JSON or YAML.
22
27
Path string `json:"path"`
23
28
}
24
29
Original file line number Diff line number Diff line change 63
63
path to a file to be parsed when generating.
64
64
properties :
65
65
path :
66
+ description : Path is the name of a file to read and
67
+ generate from can be JSON or YAML.
66
68
type : string
69
+ required :
70
+ - path
67
71
type : object
68
72
type : array
69
73
repositoryRef :
88
92
description : // ©itOpsSetTemplate describes a resource to create
89
93
properties :
90
94
content :
95
+ description : Content is the YAML to be templated and generated.
91
96
type : object
92
97
x-kubernetes-preserve-unknown-fields : true
93
98
repeat :
99
+ description : Repeat is a JSONPath string defining that the template
100
+ content should be repeated for each of the matching elements
101
+ in the JSONPath expression. https://kubernetes.io/docs/reference/kubectl/jsonpath/
94
102
type : string
95
103
required :
96
104
- content
Original file line number Diff line number Diff line change
1
+ resources :
2
+ - role.yaml
3
+ - repeated-list-generator.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : templates.weave.works/v1alpha1
2
+ kind : GitOpsSet
3
+ metadata :
4
+ name : repeated-gitopsset-sample
5
+ spec :
6
+ generators :
7
+ - list :
8
+ elements :
9
+ - env : dev
10
+ team : dev-team
11
+ teams :
12
+ - name : " team1"
13
+ - name : " team2"
14
+ - name : " team3"
15
+ - env : staging
16
+ team : staging-team
17
+ teams :
18
+ - name : " team4"
19
+ - name : " team5"
20
+ - name : " team6"
21
+ templates :
22
+ - repeat : " { .teams }"
23
+ content :
24
+ kind : ConfigMap
25
+ apiVersion : v1
26
+ metadata :
27
+ name : " {{ .repeat.name }}-demo"
28
+ data :
29
+ name : " {{ .repeat.name }}-demo"
30
+ team : " {{ .element.team }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : rbac.authorization.k8s.io/v1
3
+ kind : ClusterRole
4
+ metadata :
5
+ name : configmaps-configmaps-demo-role
6
+ rules :
7
+ - apiGroups :
8
+ - " "
9
+ resources :
10
+ - configmaps
11
+ verbs :
12
+ - create
13
+ - delete
14
+ - get
15
+ - list
16
+ - patch
17
+ - update
18
+ - watch
19
+ ---
20
+ apiVersion : rbac.authorization.k8s.io/v1
21
+ kind : ClusterRoleBinding
22
+ metadata :
23
+ name : demo-role-binding
24
+ roleRef :
25
+ apiGroup : rbac.authorization.k8s.io
26
+ kind : ClusterRole
27
+ name : configmaps-demo-role
28
+ subjects :
29
+ - kind : ServiceAccount
30
+ name : gitopssets-controller-manager
31
+ namespace : gitopssets-system
You can’t perform that action at this time.
0 commit comments