-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtypes.go
More file actions
234 lines (196 loc) · 6.75 KB
/
types.go
File metadata and controls
234 lines (196 loc) · 6.75 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package common
import (
routev1 "github.com/openshift/api/route/v1"
prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// StatusConditionType ...
type StatusConditionType string
// StatusEndpointScope ...
type StatusEndpointScope string
type StatusReferences map[string]string
const (
StatusReferenceCertSecretName = "svcCertSecretName"
StatusReferencePullSecretName = "saPullSecretName"
StatusReferenceSAResourceVersion = "saResourceVersion"
)
// StatusCondition ...
type StatusCondition interface {
GetLastTransitionTime() *metav1.Time
SetLastTransitionTime(*metav1.Time)
GetReason() string
SetReason(string)
GetMessage() string
SetMessage(string)
GetStatus() corev1.ConditionStatus
SetStatus(corev1.ConditionStatus)
GetType() StatusConditionType
SetType(StatusConditionType)
SetConditionFields(string, string, corev1.ConditionStatus) StatusCondition
}
// StatusEndpoint ...
type StatusEndpoint interface {
GetEndpointName() string
SetEndpointName(string)
GetEndpointScope() StatusEndpointScope
SetEndpointScope(StatusEndpointScope)
GetEndpointType() string
SetEndpointType(string)
GetEndpointUri() string
SetEndpointUri(string)
SetStatusEndpointFields(StatusEndpointScope, string, string) StatusEndpoint
}
// BaseComponentStatus returns base appplication status
type BaseComponentStatus interface {
GetConditions() []StatusCondition
GetCondition(StatusConditionType) StatusCondition
SetCondition(StatusCondition)
NewCondition(StatusConditionType) StatusCondition
GetStatusEndpoint(string) StatusEndpoint
SetStatusEndpoint(StatusEndpoint)
NewStatusEndpoint(string) StatusEndpoint
RemoveStatusEndpoint(string)
GetImageReference() string
SetImageReference(string)
GetBinding() *corev1.LocalObjectReference
SetBinding(*corev1.LocalObjectReference)
GetReferences() StatusReferences
SetReferences(StatusReferences)
SetReference(string, string)
}
const (
// Status Condition Types
StatusConditionTypeReconciled StatusConditionType = "Reconciled"
StatusConditionTypeResourcesReady StatusConditionType = "ResourcesReady"
StatusConditionTypeReady StatusConditionType = "Ready"
// Status Condition Type Messages
StatusConditionTypeReadyMessage string = "Application is reconciled and resources are ready."
// Status Endpoint Scopes
StatusEndpointScopeExternal StatusEndpointScope = "External"
StatusEndpointScopeInternal StatusEndpointScope = "Internal"
)
// BaseComponentAutoscaling represents basic HPA configuration
type BaseComponentAutoscaling interface {
GetMinReplicas() *int32
GetMaxReplicas() int32
GetTargetCPUUtilizationPercentage() *int32
}
// BaseComponentStorage represents basic PVC configuration
type BaseComponentStorage interface {
GetSize() string
GetClassName() string
GetMountPath() string
GetVolumeClaimTemplate() *corev1.PersistentVolumeClaim
}
// BaseComponentService represents basic service configuration
type BaseComponentService interface {
GetPort() int32
GetTargetPort() *int32
GetPortName() string
GetType() *corev1.ServiceType
GetNodePort() *int32
GetPorts() []corev1.ServicePort
GetAnnotations() map[string]string
GetCertificateSecretRef() *string
GetCertificate() BaseComponentCertificate
GetBindable() *bool
}
type BaseComponentCertificate interface {
GetAnnotations() map[string]string
}
// BaseComponentNetworkPolicy represents a basic network policy configuration
type BaseComponentNetworkPolicy interface {
GetNamespaceLabels() map[string]string
GetFromLabels() map[string]string
IsDisabled() bool
}
// BaseComponentMonitoring represents basic service monitoring configuration
type BaseComponentMonitoring interface {
GetLabels() map[string]string
GetEndpoints() []prometheusv1.Endpoint
}
// BaseComponentRoute represents route configuration
type BaseComponentRoute interface {
GetTermination() *routev1.TLSTerminationType
GetInsecureEdgeTerminationPolicy() *routev1.InsecureEdgeTerminationPolicyType
GetAnnotations() map[string]string
GetHost() string
GetPath() string
GetPathType() networkingv1.PathType
GetCertificateSecretRef() *string
}
// BaseComponentAffinity describes deployment and pod affinity
type BaseComponentAffinity interface {
GetNodeAffinity() *corev1.NodeAffinity
GetPodAffinity() *corev1.PodAffinity
GetPodAntiAffinity() *corev1.PodAntiAffinity
GetArchitecture() []string
GetNodeAffinityLabels() map[string]string
}
// BaseComponentDeployment describes deployment
type BaseComponentDeployment interface {
GetDeploymentUpdateStrategy() *appsv1.DeploymentStrategy
GetAnnotations() map[string]string
}
// BaseComponentStatefulSet describes deployment
type BaseComponentStatefulSet interface {
GetStatefulSetUpdateStrategy() *appsv1.StatefulSetUpdateStrategy
GetStorage() BaseComponentStorage
GetAnnotations() map[string]string
}
// BaseComponentProbes describes the probes for application container
type BaseComponentProbes interface {
GetLivenessProbe() *corev1.Probe
GetReadinessProbe() *corev1.Probe
GetStartupProbe() *corev1.Probe
GetDefaultLivenessProbe(ba BaseComponent) *corev1.Probe
GetDefaultReadinessProbe(ba BaseComponent) *corev1.Probe
GetDefaultStartupProbe(ba BaseComponent) *corev1.Probe
}
type BaseComponentServiceAccount interface {
GetMountToken() *bool
GetName() *string
}
type BaseComponentTopologySpreadConstraints interface {
GetConstraints() *[]corev1.TopologySpreadConstraint
GetDisableOperatorDefaults() *bool
}
// BaseComponent represents basic kubernetes application
type BaseComponent interface {
GetApplicationImage() string
GetPullPolicy() *corev1.PullPolicy
GetPullSecret() *string
GetServiceAccountName() *string
GetServiceAccount() BaseComponentServiceAccount
GetReplicas() *int32
GetProbes() BaseComponentProbes
GetVolumes() []corev1.Volume
GetVolumeMounts() []corev1.VolumeMount
GetResourceConstraints() *corev1.ResourceRequirements
GetExpose() *bool
GetEnv() []corev1.EnvVar
GetEnvFrom() []corev1.EnvFromSource
GetCreateKnativeService() *bool
GetAutoscaling() BaseComponentAutoscaling
GetService() BaseComponentService
GetNetworkPolicy() BaseComponentNetworkPolicy
GetDeployment() BaseComponentDeployment
GetStatefulSet() BaseComponentStatefulSet
GetApplicationVersion() string
GetApplicationName() string
GetMonitoring() BaseComponentMonitoring
GetLabels() map[string]string
GetAnnotations() map[string]string
GetStatus() BaseComponentStatus
GetInitContainers() []corev1.Container
GetSidecarContainers() []corev1.Container
GetGroupName() string
GetRoute() BaseComponentRoute
GetAffinity() BaseComponentAffinity
GetTopologySpreadConstraints() BaseComponentTopologySpreadConstraints
GetSecurityContext() *corev1.SecurityContext
GetManageTLS() *bool
}