Skip to content

Commit df7f8bd

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

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed

pkg/apis/v1alpha1/serviceexport.go

Lines changed: 135 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 ServiceExportConditionAccepted 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 ServiceExportConditionConflicted instead
7680
ServiceExportConflict = "Conflict"
7781
)
7882

@@ -88,3 +92,134 @@ type ServiceExportList struct {
8892
// +listType=set
8993
Items []ServiceExport `json:"items"`
9094
}
95+
96+
const (
97+
// ServiceExportConditionAccepted is true when the Service Export is accepted.
98+
// This does not indicate whether or not the configuration has been exported
99+
// to a control plane / data plane.
100+
//
101+
//
102+
// Possible reasons for this condition to be true are:
103+
//
104+
// * "Accepted"
105+
//
106+
// Possible reasons for this condition to be False are:
107+
//
108+
// * "NoService"
109+
// * "InvalidServiceType"
110+
//
111+
// Controllers may raise this condition with other reasons,
112+
// but should prefer to use the reasons listed above to improve
113+
// interoperability.
114+
ServiceExportConditionAccepted = "Accepted"
115+
116+
// ServiceExportReasonAccepted is used with the "Accepted" condition when the
117+
// condition is True.
118+
ServiceExportReasonAccepted = "Accepted"
119+
120+
// ServiceExportReasonNoService is used with the "Accepted" condition when
121+
// the associated Service does not exist.
122+
ServiceExportReasonNoService = "NoService"
123+
124+
// ServiceExportReasonInvalidServiceType is used with the "Accepted"
125+
// condition when the associated Service has an invalid type
126+
// (per the KEP at least the ExternalName type).
127+
ServiceExportReasonInvalidServiceType = "InvalidServiceType"
128+
)
129+
130+
const (
131+
// ServiceExportConditionExported is true when the service is exported to some
132+
// control plane or data plane.
133+
//
134+
//
135+
// Possible reasons for this condition to be true are:
136+
//
137+
// * "Exported"
138+
//
139+
// Possible reasons for this condition to be False are:
140+
//
141+
// * "Pending"
142+
// * "Failed"
143+
//
144+
// Possible reasons for this condition to be Unknown are:
145+
//
146+
// * "Pending"
147+
//
148+
// Controllers may raise this condition with other reasons,
149+
// but should prefer to use the reasons listed above to improve
150+
// interoperability.
151+
ServiceExportConditionExported = "Exported"
152+
153+
// ServiceExportReasonExported is used with the "Exported" condition
154+
// when the condition is True.
155+
ServiceExportReasonExported = "Exported"
156+
157+
// ServiceExportReasonPending is used with the "Exported" condition
158+
// when the service is going to be exported.
159+
ServiceExportReasonPending = "Pending"
160+
161+
// ServiceExportReasonFailed is used with the "Exported" condition
162+
// when the service failed to be exported.
163+
ServiceExportReasonFailed = "Failed"
164+
)
165+
166+
const (
167+
// ServiceExportConditionConflicted indicates that the controller was unable
168+
// to resolve conflict for a ServiceExport. This condition must be at
169+
// least raised on the conflicting ServiceExport and is recommended to
170+
// be raised on all on all the constituent `ServiceExport`s if feasible.
171+
//
172+
//
173+
// Possible reasons for this condition to be true are:
174+
//
175+
// * "PortConflict"
176+
// * "TypeConflict"
177+
// * "SessionAffinityConflict"
178+
// * "SessionAffinityConfigConflict"
179+
// * "AnnotationsConflict"
180+
// * "LabelsConflict"
181+
//
182+
// When multiple conflicts occurs the above reasons may be combined
183+
// using commas.
184+
//
185+
// Possible reasons for this condition to be False are:
186+
//
187+
// * "NoConflicts"
188+
//
189+
// Controllers may raise this condition with other reasons,
190+
// but should prefer to use the reasons listed above to improve
191+
// interoperability.
192+
ServiceExportConditionConflicted = "Conflicted"
193+
194+
// ServiceExportReasonPortConflict is used with the "Conflicted" condition
195+
// when the exported service have a conflict related to port configuration.
196+
// This includes when ports on resulting imported services would have
197+
// duplicated names (including unnamed/empty name) or duplicated
198+
// port/protocol pairs.
199+
ServiceExportReasonPortConflict = "PortConflict"
200+
201+
// ServiceExportReasonTypeConflict is used with the "Conflicted" condition
202+
// when the exported service have a conflict related to type.
203+
ServiceExportReasonTypeConflict = "TypeConflict"
204+
205+
// ServiceExportReasonSessionAffinityConflict is used with the "Conflicted"
206+
// condition when the exported service have a conflict related to session affinity.
207+
ServiceExportReasonSessionAffinityConflict = "SessionAffinityConflict"
208+
209+
// ServiceExportReasonSessionAffinityConfigConflict is used with the
210+
// "Conflicted" condition when the exported service have a conflict related
211+
// to session affinity config.
212+
ServiceExportReasonSessionAffinityConfigConflict = "SessionAffinityConfigConflict"
213+
214+
// ServiceExportReasonLabelsConflict is used with the "Conflicted"
215+
// condition when the exported service have a conflict related to labels.
216+
ServiceExportReasonLabelsConflict = "LabelsConflict"
217+
218+
// ServiceExportReasonAnnotationsConflict is used with the "Conflicted"
219+
// condition when the exported service have a conflict related to annotations.
220+
ServiceExportReasonAnnotationsConflict = "AnnotationsConflict"
221+
222+
// ServiceExportReasonNoConflicts is used with the "Conflicted" condition
223+
// when the condition is False.
224+
ServiceExportReasonNoConflicts = "NoConflicts"
225+
)

0 commit comments

Comments
 (0)