@@ -120,6 +120,12 @@ type ServiceImportStatus struct {
120
120
// +listType=map
121
121
// +listMapKey=cluster
122
122
Clusters []ClusterStatus `json:"clusters,omitempty"`
123
+ // +optional
124
+ // +patchStrategy=merge
125
+ // +patchMergeKey=type
126
+ // +listType=map
127
+ // +listMapKey=type
128
+ Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
123
129
}
124
130
125
131
// ClusterStatus contains service configuration mapped to a specific source cluster
@@ -141,3 +147,59 @@ type ServiceImportList struct {
141
147
// +listType=set
142
148
Items []ServiceImport `json:"items"`
143
149
}
150
+
151
+ // ServiceImportConditionType is a type of condition associated with a
152
+ // ServiceImport. This type should be used with the ServiceImportStatus.Conditions
153
+ // field.
154
+ type ServiceImportConditionType string
155
+
156
+ // ServiceImportConditionReason defines the set of reasons that explain why a
157
+ // particular ServiceImport condition type has been raised.
158
+ type ServiceImportConditionReason string
159
+
160
+ // NewServiceImportCondition creates a new ServiceImport condition
161
+ func NewServiceImportCondition (t ServiceImportConditionType , status metav1.ConditionStatus , reason ServiceImportConditionReason , msg string ) metav1.Condition {
162
+ return metav1.Condition {
163
+ Type : string (t ),
164
+ Status : status ,
165
+ Reason : string (reason ),
166
+ Message : msg ,
167
+ LastTransitionTime : metav1 .Now (),
168
+ }
169
+ }
170
+
171
+ const (
172
+ // ServiceImportConditionReady is true when the Service Import is ready.
173
+ //
174
+ //
175
+ // Possible reasons for this condition to be true are:
176
+ //
177
+ // * "Ready"
178
+ //
179
+ // Possible reasons for this condition to be False are:
180
+ //
181
+ // * "Pending"
182
+ // * "IPFamilyNotSupported"
183
+ //
184
+ // Possible reasons for this condition to be Unknown are:
185
+ //
186
+ // * "Pending"
187
+ //
188
+ // Controllers may raise this condition with other reasons,
189
+ // but should prefer to use the reasons listed above to improve
190
+ // interoperability.
191
+ ServiceImportConditionReady ServiceImportConditionType = "Ready"
192
+
193
+ // ServiceImportReasonReady is used with the "Ready" condition when the
194
+ // condition is True.
195
+ ServiceImportReasonReady ServiceImportConditionReason = "Ready"
196
+
197
+ // ServiceImportReasonPending is used with the "Ready" condition when
198
+ // the ServiceImport is in the process of being created or updated.
199
+ ServiceImportReasonPending ServiceImportConditionReason = "Pending"
200
+
201
+ // ServiceImportReasonIPFamilyNotSupported is used with the "Ready"
202
+ // condition when the service can not be imported due to IP families
203
+ // mismatch.
204
+ ServiceImportReasonIPFamilyNotSupported ServiceImportConditionReason = "IPFamilyNotSupported"
205
+ )
0 commit comments