Skip to content

Commit e14201a

Browse files
implementation, helper funcs and unit testfor HAProxy configuration (#26)
1 parent dde697c commit e14201a

File tree

11 files changed

+1280
-176
lines changed

11 files changed

+1280
-176
lines changed

api/v1alpha1/common_types.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,75 @@ type LogFilesConfig struct {
6363
CrashLogs bool `json:"crashLogs,omitempty"`
6464
AuditLogs bool `json:"auditLogs,omitempty"`
6565
}
66+
67+
type HAProxyConfig struct {
68+
Enabled bool `json:"enabled,omitempty"`
69+
// +kubebuilder:default:=1
70+
ReplicaCount int32 `json:"replicas,omitempty"`
71+
// +kubebuilder:default:=80
72+
FrontendPort int32 `json:"frontendPort,omitempty"`
73+
// +kubebuilder:default:={{name: "AppServices", type: "http", port: 8000, targetPort: 8000, path: "/console"}, {name: "Admin", type: "http", port: 8001, targetPort: 8001, path: "/adminUI"}, {name: "Manage", type: "http", port: 8002, targetPort: 8002, path: "/manage"}}
74+
DefaultAppServers []AppServers `json:"defaultAppServers,omitempty"`
75+
AdditionalAppServers []AppServers `json:"additionalAppServers,omitempty"`
76+
// +kubebuilder:default:=true
77+
PathBasedRouting bool `json:"pathBasedRouting,omitempty"`
78+
RestartWhenUpgrade bool `json:"restartWhenUpgrade,omitempty"`
79+
// +kubebuilder:default:={type: ClusterIP}
80+
Service ServiceForHAProxy `json:"service,omitempty"`
81+
// +kubebuilder:default:={enabled: false}
82+
TcpPorts Tcpports `json:"tcpPorts,omitempty"`
83+
// +kubebuilder:default:={client: 600, connect: 600, server: 600}
84+
Timeout Timeout `json:"timeout,omitempty"`
85+
// +kubebuilder:default:={enabled: false, secretName: "", certFileName: ""}
86+
Tls TlsForHAProxy `json:"tls,omitempty"`
87+
// +kubebuilder:default:={enabled: false, port: 1024, auth: {enabled: false, username: "", password: ""}}
88+
Stats Stats `json:"stats,omitempty"`
89+
Resources corev1.ResourceList `json:"resources,omitempty"`
90+
}
91+
92+
type AppServers struct {
93+
Name string `json:"name,omitempty"`
94+
Type string `json:"type,omitempty"`
95+
Port int32 `json:"port,omitempty"`
96+
TargetPort int32 `json:"targetPort,omitempty"`
97+
Path string `json:"path,omitempty"`
98+
}
99+
100+
type Stats struct {
101+
Enabled bool `json:"enabled,omitempty"`
102+
Port int32 `json:"port,omitempty"`
103+
Auth StatsAuth `json:"auth,omitempty"`
104+
}
105+
106+
type StatsAuth struct {
107+
Enabled bool `json:"enabled,omitempty"`
108+
Username string `json:"username,omitempty"`
109+
Password string `json:"password,omitempty"`
110+
}
111+
112+
type ServiceForHAProxy struct {
113+
Type corev1.ServiceType `json:"type,omitempty"`
114+
}
115+
116+
type Tcpports struct {
117+
Enabled bool `json:"enabled,omitempty"`
118+
Ports []TcpPort `json:"ports,omitempty"`
119+
}
120+
121+
type TcpPort struct {
122+
Port int32 `json:"port,omitempty"`
123+
Name string `json:"name,omitempty"`
124+
Type string `json:"type,omitempty"`
125+
}
126+
127+
type Timeout struct {
128+
Client int32 `json:"client,omitempty"`
129+
Connect int32 `json:"connect,omitempty"`
130+
Server int32 `json:"server,omitempty"`
131+
}
132+
133+
type TlsForHAProxy struct {
134+
Enabled bool `json:"enabled,omitempty"`
135+
SecretName string `json:"secretName,omitempty"`
136+
CertFileName string `json:"certFileName,omitempty"`
137+
}

api/v1alpha1/marklogicgroup_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ type MarklogicGroupSpec struct {
8080
DoNotDelete *bool `json:"doNotDelete,omitempty"`
8181

8282
Service Service `json:"service,omitempty"`
83+
84+
HAProxyConfig HAProxyConfig `json:"haProxyConfig,omitempty"`
8385
}
8486

8587
// InternalState defines the observed state of MarklogicGroup

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)