Skip to content

Commit 4ff0e6b

Browse files
authored
refactor: drop MetricsConfig from ToolchainStatus type (#500)
metrics are not stored in the `ToolchainStatus` anymore also, no need to keep the `MetricsConfig` in the `ToolchainConfig` anymore, since host-operator metrics are always recounted from the resources during startup. (`ForceSynchronization` was always `true`) --------- Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
1 parent 912fcbd commit 4ff0e6b

5 files changed

Lines changed: 1 addition & 203 deletions

File tree

api/v1alpha1/docs/apiref.adoc

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,6 @@ HostConfig contains all configuration parameters of the host operator
593593

594594
| *`deactivation`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-deactivationconfig[$$DeactivationConfig$$]__ | Keeps parameters concerned with user deactivation + | | Optional: \{} +
595595

596-
| *`metrics`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-metricsconfig[$$MetricsConfig$$]__ | Keeps parameters concerned with metrics + | | Optional: \{} +
597-
598596
| *`notifications`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-notificationsconfig[$$NotificationsConfig$$]__ | Keeps parameters concerned with notifications + | | Optional: \{} +
599597

600598
| *`registrationService`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-registrationserviceconfig[$$RegistrationServiceConfig$$]__ | Keeps parameters necessary for the registration service + | | Optional: \{} +
@@ -1003,8 +1001,6 @@ Member contains the status of a member cluster
10031001
| *`apiEndpoint`* __string__ | APIEndpoint is the server API URL of the cluster + | | Optional: \{} +
10041002

10051003
| *`clusterName`* __string__ | The cluster identifier + | |
1006-
| *`spaceCount`* __integer__ | Number of Spaces created within the member cluster + | | Optional: \{} +
1007-
10081004
| *`memberStatus`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-memberstatusstatus[$$MemberStatusStatus$$]__ | The array of member status objects + | |
10091005
|===
10101006

@@ -1289,45 +1285,6 @@ Members contains all configuration for member operators
12891285
|===
12901286

12911287

1292-
[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-metric"]
1293-
==== Metric
1294-
1295-
_Underlying type:_ _object_
1296-
1297-
1298-
1299-
1300-
1301-
.Appears In:
1302-
****
1303-
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-toolchainstatusstatus[$$ToolchainStatusStatus$$]
1304-
****
1305-
1306-
1307-
1308-
[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-metricsconfig"]
1309-
==== MetricsConfig
1310-
1311-
1312-
1313-
MetricsConfig contains all configuration parameters related to metrics gathering
1314-
1315-
1316-
1317-
.Appears In:
1318-
****
1319-
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-hostconfig[$$HostConfig$$]
1320-
****
1321-
1322-
[cols="20a,50a,15a,15a", options="header"]
1323-
|===
1324-
| Field | Description | Default | Validation
1325-
| *`forceSynchronization`* __boolean__ | ForceSynchronization is a flag used to trigger synchronization of the metrics +
1326-
based on the resources rather than on the content of `ToolchainStatus.status.metrics` + | | Optional: \{} +
1327-
1328-
|===
1329-
1330-
13311288
[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-nstemplateset"]
13321289
==== NSTemplateSet
13331290

@@ -3718,8 +3675,6 @@ ToolchainStatusStatus defines the observed state of the toolchain, including hos
37183675

37193676
| *`members`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-member[$$Member$$] array__ | Members is an array of member status objects + | | Optional: \{} +
37203677

3721-
| *`metrics`* __object (keys:string, values:xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-metric[$$Metric$$])__ | Metrics is a map that stores metrics to be exposed on Prometheus. + | | Optional: \{} +
3722-
37233678
| *`hostRoutes`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-hostroutes[$$HostRoutes$$]__ | HostRoutes/URLs of the host cluster, such as Proxy URL + | | Optional: \{} +
37243679

37253680
| *`conditions`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-condition[$$Condition$$] array__ | Conditions is an array of the current overall toolchain status conditions +

api/v1alpha1/toolchainconfig_types.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ type HostConfig struct {
5252
// +optional
5353
Deactivation DeactivationConfig `json:"deactivation,omitempty"`
5454

55-
// Keeps parameters concerned with metrics
56-
// +optional
57-
Metrics MetricsConfig `json:"metrics,omitempty"`
58-
5955
// Keeps parameters concerned with notifications
6056
// +optional
6157
Notifications NotificationsConfig `json:"notifications,omitempty"`
@@ -152,15 +148,6 @@ type ToolchainSecret struct {
152148
Ref *string `json:"ref,omitempty"`
153149
}
154150

155-
// MetricsConfig contains all configuration parameters related to metrics gathering
156-
// +k8s:openapi-gen=true
157-
type MetricsConfig struct {
158-
// ForceSynchronization is a flag used to trigger synchronization of the metrics
159-
// based on the resources rather than on the content of `ToolchainStatus.status.metrics`
160-
// +optional
161-
ForceSynchronization *bool `json:"forceSynchronization,omitempty"`
162-
}
163-
164151
// NotificationsConfig contains all configuration parameters related to notifications
165152
// +k8s:openapi-gen=true
166153
type NotificationsConfig struct {

api/v1alpha1/toolchainstatus_types.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ const (
5252
ToolchainStatusMemberToolchainClusterMissingReason = "MemberToolchainClusterMissing"
5353
ToolchainStatusMemberStatusConsoleRouteUnavailableReason = "ConsoleRouteUnavailable"
5454
ToolchainStatusMemberStatusRoutesAvailableReason = "RoutesAvailable"
55-
56-
// Metric Keys
57-
// MasterUserRecordsPerDomainMetricKey the key to store the metric for the number of MasterUserRecords per email address domain
58-
MasterUserRecordsPerDomainMetricKey = "masterUserRecordsPerDomain"
59-
// UserSignupsPerActivationAndDomainMetricKey the key to store the metric for the number of UserSignups per activations and per email address domain
60-
UserSignupsPerActivationAndDomainMetricKey = "userSignupsPerActivationAndDomain"
6155
)
6256

6357
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
@@ -93,12 +87,6 @@ type ToolchainStatusStatus struct {
9387
// +listMapKey=clusterName
9488
Members []Member `json:"members,omitempty" patchStrategy:"merge" patchMergeKey:"clusterName"`
9589

96-
// Metrics is a map that stores metrics to be exposed on Prometheus.
97-
// +optional
98-
// +mapType=atomic
99-
// +patchStrategy=merge
100-
Metrics map[string]Metric `json:"metrics,omitempty" patchStrategy:"merge"`
101-
10290
// HostRoutes/URLs of the host cluster, such as Proxy URL
10391
// +optional
10492
HostRoutes HostRoutes `json:"hostRoutes,omitempty"`
@@ -130,8 +118,6 @@ type HostRoutes struct {
130118
Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
131119
}
132120

133-
type Metric map[string]int
134-
135121
// HostOperatorStatus defines the observed state of a toolchain's host operator
136122
// +k8s:openapi-gen=true
137123
type HostOperatorStatus struct {
@@ -229,10 +215,6 @@ type Member struct {
229215
// The cluster identifier
230216
ClusterName string `json:"clusterName"`
231217

232-
// Number of Spaces created within the member cluster
233-
// +optional
234-
SpaceCount int `json:"spaceCount,omitempty"`
235-
236218
// The array of member status objects
237219
MemberStatus MemberStatusStatus `json:"memberStatus"`
238220
}
@@ -271,7 +253,6 @@ type RevisionCheck struct {
271253
// +k8s:openapi-gen=true
272254
// +kubebuilder:subresource:status
273255
// +kubebuilder:resource:scope=Namespaced
274-
// +kubebuilder:printcolumn:name="MURs",type="integer",JSONPath=`.status.hostOperator.masterUserRecordCount`
275256
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`
276257
// +kubebuilder:printcolumn:name="Last Updated",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].lastUpdatedTime`
277258
// +kubebuilder:validation:XPreserveUnknownFields

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha1/zz_generated.openapi.go

Lines changed: 1 addition & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)