/
types.go
88 lines (75 loc) · 2.53 KB
/
types.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// KongIngress is a top-level type. A client is created for it.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type KongIngress struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
Upstream *Upstream `json:"upstream,omitempty"`
Proxy *Proxy `json:"proxy,omitempty"`
Route *Route `json:"route,omitempty"`
}
// KongIngressList is a top-level list type. The client methods for
// lists are automatically created.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type KongIngressList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// +optional
Items []KongIngress `json:"items"`
}
// Route defines optional settings defined in Kong Routes
type Route struct {
Methods []string `json:"methods"`
RegexPriority int `json:"regex_priority"`
StripPath bool `json:"strip_path"`
PreserveHost bool `json:"preserve_host"`
}
type Upstream struct {
HashOn string `json:"hash_on"`
HashOnHeader string `json:"hash_on_header"`
HashFallback string `json:"hash_fallback"`
Healthchecks *Healthchecks `json:"healthchecks,omitempty"`
Slots int `json:"slots"`
}
type Proxy struct {
Path string `json:"path"`
ConnectTimeout int `json:"connect_timeout"`
Retries int `json:"retries"`
ReadTimeout int `json:"read_timeout"`
WriteTimeout int `json:"write_timeout"`
}
type Healthchecks struct {
Active *ActiveHealthCheck `json:"active,omitempty"`
Passive *Passive `json:"passive,omitempty"`
}
type ActiveHealthCheck struct {
Concurrency int `json:"concurrency"`
Healthy *Healthy `json:"healthy"`
HTTPPath string `json:"http_path"`
Timeout int `json:"timeout"`
Unhealthy *Unhealthy `json:"unhealthy"`
}
type Passive struct {
Healthy *Healthy `json:"healthy,omitempty"`
Unhealthy *Unhealthy `json:"unhealthy,omitempty"`
}
type Healthy struct {
HTTPStatuses []int `json:"http_statuses"`
Interval int `json:"interval"`
Successes int `json:"successes"`
}
type Unhealthy struct {
HTTPFailures int `json:"http_failures"`
HTTPStatuses []int `json:"http_statuses"`
Interval int `json:"interval"`
TCPFailures int `json:"tcp_failures"`
Timeouts int `json:"timeouts"`
}