Skip to content

Commit

Permalink
feat(cas-config): Add 'List' option to cas-config (#1824)
Browse files Browse the repository at this point in the history
Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih authored Oct 22, 2021
1 parent ac80382 commit bd98908
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/apis/openebs.io/v1alpha1/cas_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type Config struct {
Value string `json:"value"`
// Data represents an arbitrary map of key value pairs
Data map[string]string `json:"data"`
// List represents a JSON(YAML) array
List []string `json:"list"`
}

// RunTasks contains fields to run a set of
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/openebs.io/v1alpha1/cas_template_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ const (
// The corresponding value will be accessed as
// {{ .Policy.<PolicyName>.data }}
DataPTP PolicyTLPProperty = "data"

// ListPTP is the data property of the policy
// NOTE:
// The corresponding value will be accessed as
// {{ .Policy.<PolicyName>.list }}
ListPTP PolicyTLPProperty = "list"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/openebs.io/v1alpha1/cas_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func TestCASConfigJSONIndent(t *testing.T) {
Name: "Replicas",
Value: "2",
Enabled: "false",
List: []string{"openebs.io/cpu-node"},
},
[]string{`"name": "Replicas"`, `"value": "2"`, `"enabled": "false"`},
[]string{`"name": "Replicas"`, `"value": "2"`, `"enabled": "false"`, `"openebs.io/cpu-node"`},
},
}
for name, mock := range tests {
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/openebs.io/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bd98908

Please sign in to comment.