forked from hashicorp/terraform-provider-kubernetes
/
schema_node_selector_term.go
53 lines (50 loc) · 1.66 KB
/
schema_node_selector_term.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package kubernetes
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
func nodeSelectorRequirementFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Description: "The label key that the selector applies to.",
Required: true,
ForceNew: true,
},
"operator": {
Type: schema.TypeString,
Description: "A key's relationship to a set of values. Valid operators ard `In`, `NotIn`, `Exists`, `DoesNotExist`, `Gt`, and `Lt`.",
Required: true,
ForceNew: true,
},
"values": {
Type: schema.TypeSet,
Description: "An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. This array is replaced during a strategic merge patch.",
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
}
}
func nodeSelectorTermFields() map[string]*schema.Schema {
return map[string]*schema.Schema{
"match_expressions": {
Type: schema.TypeList,
Description: "A list of node selector requirements by node's labels. The requirements are ANDed.",
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: nodeSelectorRequirementFields(),
},
},
"match_fields": {
Type: schema.TypeList,
Description: "A list of node selector requirements by node's fields. The requirements are ANDed.",
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: nodeSelectorRequirementFields(),
},
},
}
}