Skip to content

Commit 2d20397

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

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

pkg/apis/v1alpha1/serviceimport.go

Lines changed: 61 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,58 @@ 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+
// 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

Comments
 (0)