@@ -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,158 @@ 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
+ }
113
+ }
114
+
115
+ const (
116
+ // ServiceExportConditionAccepted is true when the Service Export is accepted.
117
+ // This does not indicate whether or not the configuration has been exported
118
+ // to a control plane / data plane.
119
+ //
120
+ //
121
+ // Possible reasons for this condition to be true are:
122
+ //
123
+ // * "Accepted"
124
+ //
125
+ // Possible reasons for this condition to be False are:
126
+ //
127
+ // * "NoService"
128
+ // * "InvalidServiceType"
129
+ //
130
+ // Controllers may raise this condition with other reasons,
131
+ // but should prefer to use the reasons listed above to improve
132
+ // interoperability.
133
+ ServiceExportConditionAccepted ServiceExportConditionType = "Accepted"
134
+
135
+ // ServiceExportReasonAccepted is used with the "Accepted" condition when the
136
+ // condition is True.
137
+ ServiceExportReasonAccepted ServiceExportConditionReason = "Accepted"
138
+
139
+ // ServiceExportReasonNoService is used with the "Accepted" condition when
140
+ // the associated Service does not exist.
141
+ ServiceExportReasonNoService ServiceExportConditionReason = "NoService"
142
+
143
+ // ServiceExportReasonInvalidServiceType is used with the "Accepted"
144
+ // condition when the associated Service has an invalid type
145
+ // (per the KEP at least the ExternalName type).
146
+ ServiceExportReasonInvalidServiceType ServiceExportConditionReason = "InvalidServiceType"
147
+ )
148
+
149
+ const (
150
+ // ServiceExportConditionExported is true when the service is exported to some
151
+ // control plane or data plane.
152
+ //
153
+ //
154
+ // Possible reasons for this condition to be true are:
155
+ //
156
+ // * "Exported"
157
+ //
158
+ // Possible reasons for this condition to be False are:
159
+ //
160
+ // * "Pending"
161
+ // * "Failed"
162
+ //
163
+ // Possible reasons for this condition to be Unknown are:
164
+ //
165
+ // * "Pending"
166
+ //
167
+ // Controllers may raise this condition with other reasons,
168
+ // but should prefer to use the reasons listed above to improve
169
+ // interoperability.
170
+ ServiceExportConditionExported ServiceExportConditionType = "Exported"
171
+
172
+ // ServiceExportReasonExported is used with the "Exported" condition
173
+ // when the condition is True.
174
+ ServiceExportReasonExported ServiceExportConditionReason = "Exported"
175
+
176
+ // ServiceExportReasonPending is used with the "Exported" condition
177
+ // when the service is in the process of being exported.
178
+ ServiceExportReasonPending ServiceExportConditionReason = "Pending"
179
+
180
+ // ServiceExportReasonFailed is used with the "Exported" condition
181
+ // when the service failed to be exported with the message providing
182
+ // the specific reason.
183
+ ServiceExportReasonFailed ServiceExportConditionReason = "Failed"
184
+ )
185
+
186
+ const (
187
+ // ServiceExportConditionConflicted indicates that some property of an
188
+ // exported service has conflicting values across the constituent
189
+ // ServiceExports. This condition must be at least raised on the
190
+ // conflicting ServiceExport and is recommended to be raised on all on
191
+ // all the constituent ServiceExports if feasible.
192
+ //
193
+ //
194
+ // Possible reasons for this condition to be true are:
195
+ //
196
+ // * "PortConflict"
197
+ // * "TypeConflict"
198
+ // * "SessionAffinityConflict"
199
+ // * "SessionAffinityConfigConflict"
200
+ // * "AnnotationsConflict"
201
+ // * "LabelsConflict"
202
+ //
203
+ // When multiple conflicts occurs the above reasons may be combined
204
+ // using commas.
205
+ //
206
+ // Possible reasons for this condition to be False are:
207
+ //
208
+ // * "NoConflicts"
209
+ //
210
+ // Controllers may raise this condition with other reasons,
211
+ // but should prefer to use the reasons listed above to improve
212
+ // interoperability.
213
+ ServiceExportConditionConflicted ServiceExportConditionType = "Conflicted"
214
+
215
+ // ServiceExportReasonPortConflict is used with the "Conflicted" condition
216
+ // when the exported service has a conflict related to port configuration.
217
+ // This includes when ports on resulting imported services would have
218
+ // duplicated names (including unnamed/empty name) or duplicated
219
+ // port/protocol pairs.
220
+ ServiceExportReasonPortConflict ServiceExportConditionReason = "PortConflict"
221
+
222
+ // ServiceExportReasonTypeConflict is used with the "Conflicted" condition
223
+ // when the exported service has a conflict related to the service type
224
+ // (eg headless vs non-headless).
225
+ ServiceExportReasonTypeConflict ServiceExportConditionReason = "TypeConflict"
226
+
227
+ // ServiceExportReasonSessionAffinityConflict is used with the "Conflicted"
228
+ // condition when the exported service has a conflict related to session affinity.
229
+ ServiceExportReasonSessionAffinityConflict ServiceExportConditionReason = "SessionAffinityConflict"
230
+
231
+ // ServiceExportReasonSessionAffinityConfigConflict is used with the
232
+ // "Conflicted" condition when the exported service has a conflict related
233
+ // to session affinity config.
234
+ ServiceExportReasonSessionAffinityConfigConflict ServiceExportConditionReason = "SessionAffinityConfigConflict"
235
+
236
+ // ServiceExportReasonLabelsConflict is used with the "Conflicted"
237
+ // condition when the ServiceExport has a conflict related to exported
238
+ // labels.
239
+ ServiceExportReasonLabelsConflict ServiceExportConditionReason = "LabelsConflict"
240
+
241
+ // ServiceExportReasonAnnotationsConflict is used with the "Conflicted"
242
+ // condition when the ServiceExport has a conflict related to exported
243
+ // annotations.
244
+ ServiceExportReasonAnnotationsConflict ServiceExportConditionReason = "AnnotationsConflict"
245
+
246
+ // ServiceExportReasonNoConflicts is used with the "Conflicted" condition
247
+ // when the condition is False.
248
+ ServiceExportReasonNoConflicts ServiceExportConditionReason = "NoConflicts"
249
+ )
0 commit comments