Skip to content

Commit 557afe5

Browse files
committed
apis: add ServiceImport condition
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
1 parent a23ff80 commit 557afe5

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

pkg/apis/v1alpha1/serviceimport.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ type ServiceImportStatus struct {
120120
// +listType=map
121121
// +listMapKey=cluster
122122
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"`
123129
}
124130

125131
// ClusterStatus contains service configuration mapped to a specific source cluster
@@ -141,3 +147,57 @@ type ServiceImportList struct {
141147
// +listType=set
142148
Items []ServiceImport `json:"items"`
143149
}
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+
func NewServiceImportCondition(t ServiceImportConditionType, status metav1.ConditionStatus, reason ServiceImportConditionReason, msg string) metav1.Condition {
161+
return metav1.Condition{
162+
Type: string(t),
163+
Status: status,
164+
Reason: string(reason),
165+
Message: msg,
166+
}
167+
}
168+
169+
const (
170+
// ServiceImportConditionReady is true when the Service Import is ready.
171+
//
172+
//
173+
// Possible reasons for this condition to be true are:
174+
//
175+
// * "Ready"
176+
//
177+
// Possible reasons for this condition to be False are:
178+
//
179+
// * "Pending"
180+
// * "IPFamilyNotSupported"
181+
//
182+
// Possible reasons for this condition to be Unknown are:
183+
//
184+
// * "Pending"
185+
//
186+
// Controllers may raise this condition with other reasons,
187+
// but should prefer to use the reasons listed above to improve
188+
// interoperability.
189+
ServiceImportConditionReady ServiceImportType = "Ready"
190+
191+
// ServiceImportReasonReady is used with the "Ready" condition when the
192+
// condition is True.
193+
ServiceImportReasonReady ServiceImportConditionReason = "Ready"
194+
195+
// ServiceImportReasonPending is used with the "Ready" condition when
196+
// the ServiceImport is in the process of being created or updated.
197+
ServiceImportReasonPending ServiceImportConditionReason = "Pending"
198+
199+
// ServiceImportReasonIPFamilyNotSupported is used with the "Ready"
200+
// condition when the service can not be imported due to IP families
201+
// mismatch.
202+
ServiceImportReasonIPFamilyNotSupported ServiceImportConditionReason = "IPFamilyNotSupported"
203+
)

0 commit comments

Comments
 (0)