@@ -17,6 +17,7 @@ package v1alpha1
17
17
import (
18
18
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19
19
20
+ "github.com/kube-logging/telemetry-controller/pkg/resources/problem"
20
21
"github.com/kube-logging/telemetry-controller/pkg/sdk/model"
21
22
"github.com/kube-logging/telemetry-controller/pkg/sdk/model/state"
22
23
)
@@ -37,9 +38,11 @@ type SubscriptionSpec struct {
37
38
38
39
// SubscriptionStatus defines the observed state of Subscription
39
40
type SubscriptionStatus struct {
40
- Tenant string `json:"tenant,omitempty"`
41
- Outputs []NamespacedName `json:"outputs,omitempty"`
42
- State state.State `json:"state,omitempty"`
41
+ Tenant string `json:"tenant,omitempty"`
42
+ Outputs []NamespacedName `json:"outputs,omitempty"`
43
+ State state.State `json:"state,omitempty"`
44
+ Problems []string `json:"problems,omitempty"`
45
+ ProblemsCount int `json:"problemsCount,omitempty"`
43
46
}
44
47
45
48
func (s * Subscription ) GetTenant () string {
@@ -58,6 +61,23 @@ func (s *Subscription) SetState(state state.State) {
58
61
s .Status .State = state
59
62
}
60
63
64
+ func (s * Subscription ) GetProblems () []string {
65
+ return s .Status .Problems
66
+ }
67
+
68
+ func (s * Subscription ) SetProblems (problems []string ) {
69
+ s .Status .Problems = problems
70
+ s .Status .ProblemsCount = len (problems )
71
+ }
72
+
73
+ func (s * Subscription ) AddProblem (probs ... string ) {
74
+ problem .Add (s , probs ... )
75
+ }
76
+
77
+ func (s * Subscription ) ClearProblems () {
78
+ s .SetProblems ([]string {})
79
+ }
80
+
61
81
// +kubebuilder:object:root=true
62
82
// +kubebuilder:subresource:status
63
83
// +kubebuilder:printcolumn:name="Tenant",type=string,JSONPath=`.status.tenant`
0 commit comments