kubelatte-ce
Форк от sbertech/kubelatte-ce
77 строк · 1.9 Кб
1package validation
2
3import (
4"gitverse.ru/synapse/kubelatte/pkg/api/v1alpha1"
5)
6
7const Validation = "validation"
8
9type Rules struct {
10MutationRuleConfig []v1alpha1.Item
11ValidationRuleConfig []v1alpha1.Item
12}
13
14type RuleSpec struct {
15Type string `yaml:"type"`
16Items []v1alpha1.Item `yaml:"items,flow"`
17}
18
19type Rule struct {
20Simples []Simple `yaml:"simples"`
21Rego Rego `yaml:"rego"`
22}
23
24type Rego struct {
25Template string `yaml:"template"`
26Parameters string `yaml:"parameters"`
27}
28
29type Simple struct {
30Name string `yaml:"name"`
31Path string `yaml:"path"`
32Value string `yaml:"value"`
33Action string `yaml:"action"`
34Message string `yaml:"message"`
35}
36
37type Match struct {
38Kinds []Kinds `yaml:"kinds"`
39NamespaceSelector NamespaceSelector `yaml:"namespaceSelector"`
40LabelSelector LabelSelector `yaml:"labelSelector"`
41UserInfo UserInfo `yaml:"userInfo"`
42Name string `yaml:"name"`
43Scope string `yaml:"scope"`
44ExcludedNamespaces []string `yaml:"excludedNamespaces"`
45Namespaces []string `yaml:"namespaces"`
46Operations []string `yaml:"operations"`
47AnnotationNamespace string `yaml:"annotationNamespace"`
48AnnotationTrigger string `yaml:"annotationTrigger"`
49}
50
51type UserInfo struct {
52Username string `yaml:"username"`
53}
54
55type Kinds struct {
56Kinds []string `yaml:"kinds"`
57ApiGroups []string `yaml:"apiGroups"`
58}
59
60type NamespaceSelector struct {
61MatchExpressions []MatchExpression `yaml:"matchExpressions"`
62}
63
64type LabelSelector struct {
65MatchExpressions []MatchExpression `yaml:"matchExpressions"`
66}
67
68type MatchExpression struct {
69Key string `yaml:"key"`
70Operator string `yaml:"operator"`
71Values []string `yaml:"values"`
72}
73
74const (
75Deny = "deny"
76Allow = "allow"
77)
78