@@ -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,58 @@ 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
+ }
168
+ }
169
+
170
+ const (
171
+ // ServiceImportConditionReady is true when the Service Import is ready.
172
+ //
173
+ //
174
+ // Possible reasons for this condition to be true are:
175
+ //
176
+ // * "Ready"
177
+ //
178
+ // Possible reasons for this condition to be False are:
179
+ //
180
+ // * "Pending"
181
+ // * "IPFamilyNotSupported"
182
+ //
183
+ // Possible reasons for this condition to be Unknown are:
184
+ //
185
+ // * "Pending"
186
+ //
187
+ // Controllers may raise this condition with other reasons,
188
+ // but should prefer to use the reasons listed above to improve
189
+ // interoperability.
190
+ ServiceImportConditionReady ServiceImportType = "Ready"
191
+
192
+ // ServiceImportReasonReady is used with the "Ready" condition when the
193
+ // condition is True.
194
+ ServiceImportReasonReady ServiceImportConditionReason = "Ready"
195
+
196
+ // ServiceImportReasonPending is used with the "Ready" condition when
197
+ // the ServiceImport is in the process of being created or updated.
198
+ ServiceImportReasonPending ServiceImportConditionReason = "Pending"
199
+
200
+ // ServiceImportReasonIPFamilyNotSupported is used with the "Ready"
201
+ // condition when the service can not be imported due to IP families
202
+ // mismatch.
203
+ ServiceImportReasonIPFamilyNotSupported ServiceImportConditionReason = "IPFamilyNotSupported"
204
+ )
0 commit comments