kubelatte-ce

Форк
2
Форк от sbertech/kubelatte-ce
/
match_section.go 
80 строк · 2.0 Кб
1
package v1alpha1
2

3
import "reflect"
4

5
type Match struct {
6
	Operations []string `json:"operations,omitempty"`
7

8
	// +kubebuilder:validation:Enum=*;Cluster;Namespaced
9
	Scope string `json:"scope,omitempty"`
10

11
	UserInfo UserInfo `json:"userInfo,omitempty"`
12
	Kinds    []Kind   `json:"kinds"`
13

14
	Name Name `json:"name,omitempty"`
15

16
	NamespaceSelector  NamespaceSelector `json:"namespaceSelector,omitempty"`
17
	ExcludedNamespaces Namespace         `json:"excludedNamespaces,omitempty"`
18
	IncludedNamespaces Namespace         `json:"namespaces,omitempty"`
19

20
	AnnotationSelector AnnotationSelector `json:"annotationSelector,omitempty"`
21
	LabelSelector      LabelSelector      `json:"labelSelector,omitempty"`
22

23
	MatchConditions MatchConditions `json:"matchConditions,omitempty"`
24
}
25

26
type Namespace struct {
27
	Values []string `json:"values,omitempty"`
28
	Regex  []string `json:"regex,omitempty"`
29
}
30

31
type Name struct {
32
	Value string `json:"value,omitempty"`
33
	Regex string `json:"regex,omitempty"`
34
}
35

36
type MatchConditions struct {
37
	Object    []Obj `json:"object,omitempty"`
38
	OldObject []Obj `json:"oldObject,omitempty"`
39
}
40

41
type Obj struct {
42
	Path string `json:"path"`
43

44
	// +kubebuilder:validation:Enum=MustExist;MustNotExist
45
	Condition string `json:"condition"`
46
}
47

48
type Kind struct {
49
	Kind      []string `json:"kinds,omitempty"`
50
	ApiGroups []string `json:"apiGroups,omitempty"`
51
}
52

53
type UserInfo struct {
54
	Username      string `json:"username,omitempty"`
55
	UsernameRegex string `json:"usernameRegex,omitempty"`
56
}
57

58
type NamespaceSelector struct {
59
	MatchExpressions []MatchExpression `json:"matchExpressions"`
60
}
61

62
type AnnotationSelector struct {
63
	MatchExpressions []MatchExpression `json:"matchExpressions"`
64
}
65

66
type LabelSelector struct {
67
	MatchExpressions []MatchExpression `json:"matchExpressions"`
68
}
69

70
type MatchExpression struct {
71
	Key string `json:"key"`
72

73
	// +kubebuilder:validation:Enum=In;NotIn;Exists;DoesNotExist
74
	Operator string   `json:"operator"`
75
	Values   []string `json:"values,omitempty"`
76
}
77

78
func (in *Match) IsEmpty() bool {
79
	return reflect.DeepEqual(*in, Match{})
80
}
81

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.