-
Notifications
You must be signed in to change notification settings - Fork 42
/
configuration.go
91 lines (76 loc) · 3.42 KB
/
configuration.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
89
90
91
package v1
import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
/*
XXX: Ensure code generators are re-run anytime fields are added, removed, or
their types changed!
*/
// Variable is a named secret.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Variable struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
// Name is the name by which the variable will be used by the client.
Name string `json:"name,omitempty" yaml:",omitempty"`
// Provider is the provider name.
Provider string `json:"provider"`
// Value is the identifier of the secret that the Provider will load.
ID string `json:"id"`
}
// Listener listens on a port on socket for inbound connections, which are
// handed off to Handlers.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Listener struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Address string `json:"address,omitempty" yaml:",omitempty"`
CACertFiles []string `yaml:"caCertFiles,omitempty" yaml:",omitempty"`
Debug bool `json:"debug,omitempty" yaml:",omitempty"`
Name string `json:"name"`
Protocol string `json:"protocol"`
Socket string `json:"socket,omitempty" yaml:",omitempty"`
}
// Handler processes an inbound message and connects to a specified backend
// using Credentials which it fetches from a provider.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Handler struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:",omitempty"`
Type string `json:"type"`
ListenerName string `json:"listener" yaml:"listener"`
Debug bool `json:"debug,omitempty" yaml:",omitempty"`
Match []string `json:"match,omitempty" yaml:",omitempty"`
Credentials []Variable `json:"credentials,omitempty" yaml:",omitempty"`
}
// ConfigurationSpec is the main configuration structure for Secretless.
// It lists and configures the protocol listeners and handlers.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ConfigurationSpec struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Listeners []Listener `json:"listeners"`
Handlers []Handler `json:"handlers"`
}
// Configuration is the generic CRD API type wrapping our spec
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Configuration struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Spec ConfigurationSpec `json:"spec"`
Status ConfigurationStatus `json:"status"`
}
// ConfigurationStatus is used to indicate what state the CRD is in
type ConfigurationStatus struct {
AvailableReplicas int32 `json:"availableReplicas"`
}
// ConfigurationList is an array container of our CRD resources
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ConfigurationList struct {
meta_v1.TypeMeta `json:",omitempty" yaml:",omitempty"`
meta_v1.ListMeta `json:"metadata" yaml:"metadata,omitempty"`
Items []Configuration `json:"items"`
}