@@ -132,6 +132,12 @@ type ServiceImportStatus struct {
132132 // +listType=map
133133 // +listMapKey=cluster
134134 Clusters []ClusterStatus `json:"clusters,omitempty"`
135+ // +optional
136+ // +patchStrategy=merge
137+ // +patchMergeKey=type
138+ // +listType=map
139+ // +listMapKey=type
140+ Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
135141}
136142
137143// ClusterStatus contains service configuration mapped to a specific source cluster
@@ -153,3 +159,59 @@ type ServiceImportList struct {
153159 // +listType=set
154160 Items []ServiceImport `json:"items"`
155161}
162+
163+ // ServiceImportConditionType is a type of condition associated with a
164+ // ServiceImport. This type should be used with the ServiceImportStatus.Conditions
165+ // field.
166+ type ServiceImportConditionType string
167+
168+ // ServiceImportConditionReason defines the set of reasons that explain why a
169+ // particular ServiceImport condition type has been raised.
170+ type ServiceImportConditionReason string
171+
172+ // NewServiceImportCondition creates a new ServiceImport condition
173+ func NewServiceImportCondition (t ServiceImportConditionType , status metav1.ConditionStatus , reason ServiceImportConditionReason , msg string ) metav1.Condition {
174+ return metav1.Condition {
175+ Type : string (t ),
176+ Status : status ,
177+ Reason : string (reason ),
178+ Message : msg ,
179+ LastTransitionTime : metav1 .Now (),
180+ }
181+ }
182+
183+ const (
184+ // ServiceImportConditionReady is true when the Service Import is ready.
185+ //
186+ //
187+ // Possible reasons for this condition to be true are:
188+ //
189+ // * "Ready"
190+ //
191+ // Possible reasons for this condition to be False are:
192+ //
193+ // * "Pending"
194+ // * "IPFamilyNotSupported"
195+ //
196+ // Possible reasons for this condition to be Unknown are:
197+ //
198+ // * "Pending"
199+ //
200+ // Controllers may raise this condition with other reasons,
201+ // but should prefer to use the reasons listed above to improve
202+ // interoperability.
203+ ServiceImportConditionReady ServiceImportConditionType = "Ready"
204+
205+ // ServiceImportReasonReady is used with the "Ready" condition when the
206+ // condition is True.
207+ ServiceImportReasonReady ServiceImportConditionReason = "Ready"
208+
209+ // ServiceImportReasonPending is used with the "Ready" condition when
210+ // the ServiceImport is in the process of being created or updated.
211+ ServiceImportReasonPending ServiceImportConditionReason = "Pending"
212+
213+ // ServiceImportReasonIPFamilyNotSupported is used with the "Ready"
214+ // condition when the service can not be imported due to IP families
215+ // mismatch.
216+ ServiceImportReasonIPFamilyNotSupported ServiceImportConditionReason = "IPFamilyNotSupported"
217+ )
0 commit comments