Skip to content

Commit 1c1a161

Browse files
committed
apis: add ServiceExport condition type/reasons
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
1 parent a23ff80 commit 1c1a161

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed

pkg/apis/v1alpha1/serviceexport.go

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ const (
6666
// service export has been recognized as valid by an mcs-controller.
6767
// This will be false if the service is found to be unexportable
6868
// (ExternalName, not found).
69+
//
70+
// Deprecated: use ServiceExportConditionValid instead
6971
ServiceExportValid = "Valid"
7072
// ServiceExportConflict means that there is a conflict between two
7173
// exports for the same Service. When "True", the condition message
7274
// should contain enough information to diagnose the conflict:
7375
// field(s) under contention, which cluster won, and why.
7476
// Users should not expect detailed per-cluster information in the
7577
// conflict message.
78+
//
79+
// Deprecated: use ServiceExportConditionConflict instead
7680
ServiceExportConflict = "Conflict"
7781
)
7882

@@ -88,3 +92,133 @@ type ServiceExportList struct {
8892
// +listType=set
8993
Items []ServiceExport `json:"items"`
9094
}
95+
96+
// ServiceExportConditionType is a type of condition associated with ServiceExport.
97+
// This type should be used with the ServiceExportStatus.Conditions
98+
// field.
99+
type ServiceExportConditionType string
100+
101+
// ServiceExportConditionReason defines the set of reasons that explain
102+
// why a particular conflict condition type has been raised.
103+
type ServiceExportConditionReason string
104+
105+
const (
106+
// ServiceExportConditionValid is true when the Service Export is valid. This does
107+
// not indicate whether or not the configuration has been exported to
108+
// a control plane / data plane.
109+
//
110+
//
111+
// Possible reasons for this condition to be true are:
112+
//
113+
// * "Valid"
114+
//
115+
// Possible reasons for this condition to be False are:
116+
//
117+
// * "NoService"
118+
// * "InvalidServiceType"
119+
//
120+
// Controllers may raise this condition with other reasons,
121+
// but should prefer to use the reasons listed above to improve
122+
// interoperability.
123+
ServiceExportConditionValid ServiceExportConditionType = "Valid"
124+
125+
// ServiceExportReasonValid is used with the "Valid" condition when the
126+
// condition is True.
127+
ServiceExportReasonValid ServiceExportConditionReason = "Valid"
128+
129+
// ServiceExportReasonNoService is used with the "Valid" condition when
130+
// the associated Service does not exist.
131+
ServiceExportReasonNoService ServiceExportConditionReason = "NoService"
132+
133+
// ServiceExportReasonInvalidServiceType is used with the "Valid"
134+
// condition when the associated Service has an invalid type
135+
// (per the KEP at least the ExternalName type).
136+
ServiceExportReasonInvalidServiceType ServiceExportConditionReason = "InvalidServiceType"
137+
)
138+
139+
const (
140+
// ServiceExportConditionExported is true when the service is exported to some
141+
// control plane or data plane.
142+
//
143+
//
144+
// Possible reasons for this condition to be true are:
145+
//
146+
// * "Exported"
147+
//
148+
// Possible reasons for this condition to be False are:
149+
//
150+
// * "Invalid"
151+
// * "Pending"
152+
//
153+
// Possible reasons for this condition to be Unknown are:
154+
//
155+
// * "Pending"
156+
//
157+
// Controllers may raise this condition with other reasons,
158+
// but should prefer to use the reasons listed above to improve
159+
// interoperability.
160+
ServiceExportConditionExported ServiceExportConditionType = "Exported"
161+
162+
// ServiceExportReasonExported is used with the "Exported" condition
163+
// when the condition is True.
164+
ServiceExportReasonExported ServiceExportConditionReason = "Exported"
165+
166+
// ServiceExportReasonInvalid is used with the "Exported" condition
167+
// when the exported service is invalid and will not be exported.
168+
ServiceExportReasonInvalid ServiceExportConditionReason = "Invalid"
169+
170+
// ServiceExportReasonPending is used with the "Exported" condition
171+
// when the service is going to be exported.
172+
ServiceExportReasonPending ServiceExportConditionReason = "Pending"
173+
)
174+
175+
const (
176+
// ConflictConditionConflict indicates that the controller was unable
177+
// to resolve conflict for a ServiceExport. This condition must be at
178+
// least raised on the conflicting ServiceExport and is recommended to
179+
// be raised on all on all the constituent `ServiceExport`s if feasible.
180+
//
181+
//
182+
// Possible reasons for this condition to be true are:
183+
//
184+
// * "PortsConflict"
185+
// * "TypeConflict"
186+
// * "SessionAffinityConflict"
187+
// * "SessionAffinityConfigConflict"
188+
// * "MultipleConflicts"
189+
//
190+
// Possible reasons for this condition to be False are:
191+
//
192+
// * "NoConflicts"
193+
//
194+
// Controllers may raise this condition with other reasons,
195+
// but should prefer to use the reasons listed above to improve
196+
// interoperability.
197+
ServiceExportConditionConflict ServiceExportConditionType = "Conflict"
198+
199+
// ServiceExportReasonPortsConflict is used with the "Conflict" condition
200+
// when the exported service have a conflict related to ports.
201+
ServiceExportReasonPortsConflict ServiceExportConditionReason = "PortsConflict"
202+
203+
// ServiceExportReasonTypeConflict is used with the "Conflict" condition
204+
// when the exported service have a conflict related to type.
205+
ServiceExportReasonTypeConflict ServiceExportConditionReason = "TypeConflict"
206+
207+
// ServiceExportReasonSessionAffinityConflict is used with the "Conflict"
208+
// condition when the exported service have a conflict related to session affinity.
209+
ServiceExportReasonSessionAffinityConflict ServiceExportConditionReason = "SessionAffinityConflict"
210+
211+
// ServiceExportReasonSessionAffinityConfigConflict is used with the
212+
// "Conflict" condition when the exported service have a conflict related
213+
// to session affinity config.
214+
ServiceExportReasonSessionAffinityConfigConflict ServiceExportConditionReason = "SessionAffinityConfigConflict"
215+
216+
// ServiceexportReasonMultipleConflicts is used with the "Conflict"
217+
// condition when the exported service have multiple conflicts if the
218+
// implementation coalesce those.
219+
ServiceExportReasonMultipleConflicts ServiceExportConditionReason = "MultipleConflicts"
220+
221+
// ServiceExportReasonNoConflicts is used with the "Conflict" condition
222+
// when the condition is False.
223+
ServiceExportReasonNoConflicts ServiceExportConditionReason = "NoConflicts"
224+
)

0 commit comments

Comments
 (0)