77 "errors"
88
99 corev1 "k8s.io/api/core/v1"
10- "k8s.io/apimachinery/pkg/api/meta"
1110 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1211)
1312
@@ -225,19 +224,15 @@ type DatasourceSpec struct {
225224}
226225
227226const (
228- // Something went wrong during the syncing of the datasource.
229- DatasourceConditionError = "Error"
230- // The datasource is waiting for a dependency datasource to become available.
231- DatasourceConditionWaiting = "Waiting"
227+ // The datasource is ready to be used.
228+ DatasourceConditionReady = "Ready"
232229)
233230
234231type DatasourceStatus struct {
235232 // When the datasource was last successfully synced.
236233 LastSynced metav1.Time `json:"lastSynced,omitempty"`
237234 // The number of objects currently stored for this datasource.
238235 NumberOfObjects int64 `json:"numberOfObjects,omitempty"`
239- // The time it took to perform the last sync.
240- Took metav1.Duration `json:"took"`
241236 // Planned time for the next sync.
242237 NextSyncTime metav1.Time `json:"nextSyncTime,omitempty"`
243238
@@ -246,27 +241,16 @@ type DatasourceStatus struct {
246241 Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
247242}
248243
249- // Helper function to check if the datasource is ready.
250- func (s * DatasourceStatus ) IsReady () bool {
251- if meta .IsStatusConditionTrue (s .Conditions , DatasourceConditionError ) {
252- return false
253- }
254- if meta .IsStatusConditionTrue (s .Conditions , DatasourceConditionWaiting ) {
255- return false
256- }
257- return s .NumberOfObjects > 0
258- }
259-
260244// +kubebuilder:object:root=true
261245// +kubebuilder:subresource:status
262246// +kubebuilder:resource:scope=Cluster
263247// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type"
264248// +kubebuilder:printcolumn:name="Domain",type="string",JSONPath=".spec.schedulingDomain"
265249// +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".metadata.creationTimestamp"
266250// +kubebuilder:printcolumn:name="Synced",type="date",JSONPath=".status.lastSynced"
267- // +kubebuilder:printcolumn:name="Took",type="string",JSONPath=".status.took"
268251// +kubebuilder:printcolumn:name="Next",type="string",JSONPath=".status.nextSyncTime"
269252// +kubebuilder:printcolumn:name="Objects",type="integer",JSONPath=".status.numberOfObjects"
253+ // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
270254
271255// Datasource is the Schema for the datasources API
272256type Datasource struct {
0 commit comments