@@ -78,13 +78,17 @@ const (
7878 // service export has been recognized as valid by an mcs-controller.
7979 // This will be false if the service is found to be unexportable
8080 // (ExternalName, not found).
81+ //
82+ // Deprecated: use ServiceExportConditionValid instead
8183 ServiceExportValid = "Valid"
8284 // ServiceExportConflict means that there is a conflict between two
8385 // exports for the same Service. When "True", the condition message
8486 // should contain enough information to diagnose the conflict:
8587 // field(s) under contention, which cluster won, and why.
8688 // Users should not expect detailed per-cluster information in the
8789 // conflict message.
90+ //
91+ // Deprecated: use ServiceExportConditionConflict instead
8892 ServiceExportConflict = "Conflict"
8993)
9094
@@ -100,3 +104,168 @@ type ServiceExportList struct {
100104 // +listType=set
101105 Items []ServiceExport `json:"items"`
102106}
107+
108+ // ServiceExportConditionType is a type of condition associated with a
109+ // ServiceExport. This type should be used with the ServiceExportStatus.Conditions
110+ // field.
111+ type ServiceExportConditionType string
112+
113+ // ServiceExportConditionReason defines the set of reasons that explain why a
114+ // particular ServiceExport condition type has been raised.
115+ type ServiceExportConditionReason string
116+
117+ // NewServiceExportCondition creates a new ServiceExport condition
118+ func NewServiceExportCondition (t ServiceExportConditionType , status metav1.ConditionStatus , reason ServiceExportConditionReason , msg string ) metav1.Condition {
119+ return metav1.Condition {
120+ Type : string (t ),
121+ Status : status ,
122+ Reason : string (reason ),
123+ Message : msg ,
124+ LastTransitionTime : metav1 .Now (),
125+ }
126+ }
127+
128+ const (
129+ // ServiceExportConditionValid is true when the Service Export is valid.
130+ // This does not indicate whether or not the configuration has been exported
131+ // to a control plane / data plane.
132+ //
133+ //
134+ // Possible reasons for this condition to be true are:
135+ //
136+ // * "Valid"
137+ //
138+ // Possible reasons for this condition to be False are:
139+ //
140+ // * "NoService"
141+ // * "InvalidServiceType"
142+ //
143+ // Controllers may raise this condition with other reasons,
144+ // but should prefer to use the reasons listed above to improve
145+ // interoperability.
146+ ServiceExportConditionValid ServiceExportConditionType = "Valid"
147+
148+ // ServiceExportReasonValid is used with the "Valid" condition when the
149+ // condition is True.
150+ ServiceExportReasonValid ServiceExportConditionReason = "Valid"
151+
152+ // ServiceExportReasonNoService is used with the "Valid" condition when
153+ // the associated Service does not exist.
154+ ServiceExportReasonNoService ServiceExportConditionReason = "NoService"
155+
156+ // ServiceExportReasonInvalidServiceType is used with the "Valid"
157+ // condition when the associated Service has an invalid type
158+ // (per the KEP at least the ExternalName type).
159+ ServiceExportReasonInvalidServiceType ServiceExportConditionReason = "InvalidServiceType"
160+ )
161+
162+ const (
163+ // ServiceExportConditionReady is true when the service is exported
164+ // to some control plane or data plane or ready to be pulled.
165+ //
166+ //
167+ // Possible reasons for this condition to be true are:
168+ //
169+ // * "Exported"
170+ // * "Ready"
171+ //
172+ // Possible reasons for this condition to be False are:
173+ //
174+ // * "Pending"
175+ // * "Failed"
176+ //
177+ // Possible reasons for this condition to be Unknown are:
178+ //
179+ // * "Pending"
180+ //
181+ // Controllers may raise this condition with other reasons,
182+ // but should prefer to use the reasons listed above to improve
183+ // interoperability.
184+ ServiceExportConditionReady ServiceExportConditionType = "Ready"
185+
186+ // ServiceExportReasonExported is used with the "Ready" condition
187+ // when the condition is True and the service has been exported.
188+ // This would be used when an implementation exports a service
189+ // to a control plane or data plane.
190+ ServiceExportReasonExported ServiceExportConditionReason = "Exported"
191+
192+ // ServiceExportReasonReady is used with the "Ready" condition
193+ // when the condition is True and the service has been exported.
194+ // This would typically be used in an implementation that uses a
195+ // pull model.
196+ ServiceExportReasonReady ServiceExportConditionReason = "Ready"
197+
198+ // ServiceExportReasonPending is used with the "Ready" condition
199+ // when the service is in the process of being exported.
200+ ServiceExportReasonPending ServiceExportConditionReason = "Pending"
201+
202+ // ServiceExportReasonFailed is used with the "Ready" condition
203+ // when the service failed to be exported with the message providing
204+ // the specific reason.
205+ ServiceExportReasonFailed ServiceExportConditionReason = "Failed"
206+ )
207+
208+ const (
209+ // ServiceExportConditionConflict indicates that some property of an
210+ // exported service has conflicting values across the constituent
211+ // ServiceExports. This condition must be at least raised on the
212+ // conflicting ServiceExport and is recommended to be raised on all on
213+ // all the constituent ServiceExports if feasible.
214+ //
215+ //
216+ // Possible reasons for this condition to be true are:
217+ //
218+ // * "PortConflict"
219+ // * "TypeConflict"
220+ // * "SessionAffinityConflict"
221+ // * "SessionAffinityConfigConflict"
222+ // * "AnnotationsConflict"
223+ // * "LabelsConflict"
224+ //
225+ // When multiple conflicts occurs the above reasons may be combined
226+ // using commas.
227+ //
228+ // Possible reasons for this condition to be False are:
229+ //
230+ // * "NoConflicts"
231+ //
232+ // Controllers may raise this condition with other reasons,
233+ // but should prefer to use the reasons listed above to improve
234+ // interoperability.
235+ ServiceExportConditionConflict ServiceExportConditionType = "Conflict"
236+
237+ // ServiceExportReasonPortConflict is used with the "Conflict" condition
238+ // when the exported service has a conflict related to port configuration.
239+ // This includes when ports on resulting imported services would have
240+ // duplicated names (including unnamed/empty name) or duplicated
241+ // port/protocol pairs.
242+ ServiceExportReasonPortConflict ServiceExportConditionReason = "PortConflict"
243+
244+ // ServiceExportReasonTypeConflict is used with the "Conflict" condition
245+ // when the exported service has a conflict related to the service type
246+ // (eg headless vs non-headless).
247+ ServiceExportReasonTypeConflict ServiceExportConditionReason = "TypeConflict"
248+
249+ // ServiceExportReasonSessionAffinityConflict is used with the "Conflict"
250+ // condition when the exported service has a conflict related to session affinity.
251+ ServiceExportReasonSessionAffinityConflict ServiceExportConditionReason = "SessionAffinityConflict"
252+
253+ // ServiceExportReasonSessionAffinityConfigConflict is used with the
254+ // "Conflict" condition when the exported service has a conflict related
255+ // to session affinity config.
256+ ServiceExportReasonSessionAffinityConfigConflict ServiceExportConditionReason = "SessionAffinityConfigConflict"
257+
258+ // ServiceExportReasonLabelsConflict is used with the "Conflict"
259+ // condition when the ServiceExport has a conflict related to exported
260+ // labels.
261+ ServiceExportReasonLabelsConflict ServiceExportConditionReason = "LabelsConflict"
262+
263+ // ServiceExportReasonAnnotationsConflict is used with the "Conflict"
264+ // condition when the ServiceExport has a conflict related to exported
265+ // annotations.
266+ ServiceExportReasonAnnotationsConflict ServiceExportConditionReason = "AnnotationsConflict"
267+
268+ // ServiceExportReasonNoConflicts is used with the "Conflict" condition
269+ // when the condition is False.
270+ ServiceExportReasonNoConflicts ServiceExportConditionReason = "NoConflicts"
271+ )
0 commit comments