@@ -66,13 +66,17 @@ const (
66
66
// service export has been recognized as valid by an mcs-controller.
67
67
// This will be false if the service is found to be unexportable
68
68
// (ExternalName, not found).
69
+ //
70
+ // Deprecated: use ServiceExportConditionAccepted instead
69
71
ServiceExportValid = "Valid"
70
72
// ServiceExportConflict means that there is a conflict between two
71
73
// exports for the same Service. When "True", the condition message
72
74
// should contain enough information to diagnose the conflict:
73
75
// field(s) under contention, which cluster won, and why.
74
76
// Users should not expect detailed per-cluster information in the
75
77
// conflict message.
78
+ //
79
+ // Deprecated: use ServiceExportConditionConflicted instead
76
80
ServiceExportConflict = "Conflict"
77
81
)
78
82
@@ -88,3 +92,159 @@ type ServiceExportList struct {
88
92
// +listType=set
89
93
Items []ServiceExport `json:"items"`
90
94
}
95
+
96
+ // ServiceExportConditionType is a type of condition associated with a
97
+ // ServiceExport. 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 why a
102
+ // particular ServiceExport condition type has been raised.
103
+ type ServiceExportConditionReason string
104
+
105
+ // NewServiceExportCondition creates a new ServiceExport condition
106
+ func NewServiceExportCondition (t ServiceExportConditionType , status metav1.ConditionStatus , reason ServiceExportConditionReason , msg string ) metav1.Condition {
107
+ return metav1.Condition {
108
+ Type : string (t ),
109
+ Status : status ,
110
+ Reason : string (reason ),
111
+ Message : msg ,
112
+ LastTransitionTime : metav1 .Now (),
113
+ }
114
+ }
115
+
116
+ const (
117
+ // ServiceExportConditionAccepted is true when the Service Export is accepted.
118
+ // This does not indicate whether or not the configuration has been exported
119
+ // to a control plane / data plane.
120
+ //
121
+ //
122
+ // Possible reasons for this condition to be true are:
123
+ //
124
+ // * "Accepted"
125
+ //
126
+ // Possible reasons for this condition to be False are:
127
+ //
128
+ // * "NoService"
129
+ // * "InvalidServiceType"
130
+ //
131
+ // Controllers may raise this condition with other reasons,
132
+ // but should prefer to use the reasons listed above to improve
133
+ // interoperability.
134
+ ServiceExportConditionAccepted ServiceExportConditionType = "Accepted"
135
+
136
+ // ServiceExportReasonAccepted is used with the "Accepted" condition when the
137
+ // condition is True.
138
+ ServiceExportReasonAccepted ServiceExportConditionReason = "Accepted"
139
+
140
+ // ServiceExportReasonNoService is used with the "Accepted" condition when
141
+ // the associated Service does not exist.
142
+ ServiceExportReasonNoService ServiceExportConditionReason = "NoService"
143
+
144
+ // ServiceExportReasonInvalidServiceType is used with the "Accepted"
145
+ // condition when the associated Service has an invalid type
146
+ // (per the KEP at least the ExternalName type).
147
+ ServiceExportReasonInvalidServiceType ServiceExportConditionReason = "InvalidServiceType"
148
+ )
149
+
150
+ const (
151
+ // ServiceExportConditionExported is true when the service is exported to some
152
+ // control plane or data plane.
153
+ //
154
+ //
155
+ // Possible reasons for this condition to be true are:
156
+ //
157
+ // * "Exported"
158
+ //
159
+ // Possible reasons for this condition to be False are:
160
+ //
161
+ // * "Pending"
162
+ // * "Failed"
163
+ //
164
+ // Possible reasons for this condition to be Unknown are:
165
+ //
166
+ // * "Pending"
167
+ //
168
+ // Controllers may raise this condition with other reasons,
169
+ // but should prefer to use the reasons listed above to improve
170
+ // interoperability.
171
+ ServiceExportConditionExported ServiceExportConditionType = "Exported"
172
+
173
+ // ServiceExportReasonExported is used with the "Exported" condition
174
+ // when the condition is True.
175
+ ServiceExportReasonExported ServiceExportConditionReason = "Exported"
176
+
177
+ // ServiceExportReasonPending is used with the "Exported" condition
178
+ // when the service is in the process of being exported.
179
+ ServiceExportReasonPending ServiceExportConditionReason = "Pending"
180
+
181
+ // ServiceExportReasonFailed is used with the "Exported" condition
182
+ // when the service failed to be exported with the message providing
183
+ // the specific reason.
184
+ ServiceExportReasonFailed ServiceExportConditionReason = "Failed"
185
+ )
186
+
187
+ const (
188
+ // ServiceExportConditionConflicted indicates that some property of an
189
+ // exported service has conflicting values across the constituent
190
+ // ServiceExports. This condition must be at least raised on the
191
+ // conflicting ServiceExport and is recommended to be raised on all on
192
+ // all the constituent ServiceExports if feasible.
193
+ //
194
+ //
195
+ // Possible reasons for this condition to be true are:
196
+ //
197
+ // * "PortConflict"
198
+ // * "TypeConflict"
199
+ // * "SessionAffinityConflict"
200
+ // * "SessionAffinityConfigConflict"
201
+ // * "AnnotationsConflict"
202
+ // * "LabelsConflict"
203
+ //
204
+ // When multiple conflicts occurs the above reasons may be combined
205
+ // using commas.
206
+ //
207
+ // Possible reasons for this condition to be False are:
208
+ //
209
+ // * "NoConflicts"
210
+ //
211
+ // Controllers may raise this condition with other reasons,
212
+ // but should prefer to use the reasons listed above to improve
213
+ // interoperability.
214
+ ServiceExportConditionConflicted ServiceExportConditionType = "Conflicted"
215
+
216
+ // ServiceExportReasonPortConflict is used with the "Conflicted" condition
217
+ // when the exported service has a conflict related to port configuration.
218
+ // This includes when ports on resulting imported services would have
219
+ // duplicated names (including unnamed/empty name) or duplicated
220
+ // port/protocol pairs.
221
+ ServiceExportReasonPortConflict ServiceExportConditionReason = "PortConflict"
222
+
223
+ // ServiceExportReasonTypeConflict is used with the "Conflicted" condition
224
+ // when the exported service has a conflict related to the service type
225
+ // (eg headless vs non-headless).
226
+ ServiceExportReasonTypeConflict ServiceExportConditionReason = "TypeConflict"
227
+
228
+ // ServiceExportReasonSessionAffinityConflict is used with the "Conflicted"
229
+ // condition when the exported service has a conflict related to session affinity.
230
+ ServiceExportReasonSessionAffinityConflict ServiceExportConditionReason = "SessionAffinityConflict"
231
+
232
+ // ServiceExportReasonSessionAffinityConfigConflict is used with the
233
+ // "Conflicted" condition when the exported service has a conflict related
234
+ // to session affinity config.
235
+ ServiceExportReasonSessionAffinityConfigConflict ServiceExportConditionReason = "SessionAffinityConfigConflict"
236
+
237
+ // ServiceExportReasonLabelsConflict is used with the "Conflicted"
238
+ // condition when the ServiceExport has a conflict related to exported
239
+ // labels.
240
+ ServiceExportReasonLabelsConflict ServiceExportConditionReason = "LabelsConflict"
241
+
242
+ // ServiceExportReasonAnnotationsConflict is used with the "Conflicted"
243
+ // condition when the ServiceExport has a conflict related to exported
244
+ // annotations.
245
+ ServiceExportReasonAnnotationsConflict ServiceExportConditionReason = "AnnotationsConflict"
246
+
247
+ // ServiceExportReasonNoConflicts is used with the "Conflicted" condition
248
+ // when the condition is False.
249
+ ServiceExportReasonNoConflicts ServiceExportConditionReason = "NoConflicts"
250
+ )
0 commit comments