diff --git a/apis/monitoring/v1beta1/monitoringdashboard_types.go b/apis/monitoring/v1beta1/monitoringdashboard_types.go index d6eac80630e..f75dc3341df 100644 --- a/apis/monitoring/v1beta1/monitoringdashboard_types.go +++ b/apis/monitoring/v1beta1/monitoringdashboard_types.go @@ -703,11 +703,9 @@ type Scorecard struct { // Will cause the scorecard to show a spark chart. SparkChartView *Scorecard_SparkChartView `json:"sparkChartView,omitempty"` - /*NOTYET // Will cause the `Scorecard` to show only the value, with no indicator to // its value relative to its thresholds. - BlankView *Empty `json:"blankView,omitempty"` - */ + BlankView *BlankView `json:"blankView,omitempty"` // The thresholds used to determine the state of the scorecard given the // time series' current value. For an actual value x, the scorecard is in a @@ -750,6 +748,9 @@ type Scorecard struct { Thresholds []Threshold `json:"thresholds,omitempty"` } +type BlankView struct { +} + // +kcc:proto=google.monitoring.dashboard.v1.Scorecard.GaugeView type Scorecard_GaugeView struct { // The lower bound for this gauge chart. The value of the chart should diff --git a/apis/monitoring/v1beta1/zz_generated.deepcopy.go b/apis/monitoring/v1beta1/zz_generated.deepcopy.go index c5977df3a9b..f7e611fd0cc 100644 --- a/apis/monitoring/v1beta1/zz_generated.deepcopy.go +++ b/apis/monitoring/v1beta1/zz_generated.deepcopy.go @@ -81,6 +81,22 @@ func (in *AlertChart) DeepCopy() *AlertChart { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlankView) DeepCopyInto(out *BlankView) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlankView. +func (in *BlankView) DeepCopy() *BlankView { + if in == nil { + return nil + } + out := new(BlankView) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ChartOptions) DeepCopyInto(out *ChartOptions) { *out = *in @@ -746,6 +762,11 @@ func (in *Scorecard) DeepCopyInto(out *Scorecard) { *out = new(Scorecard_SparkChartView) (*in).DeepCopyInto(*out) } + if in.BlankView != nil { + in, out := &in.BlankView, &out.BlankView + *out = new(BlankView) + **out = **in + } if in.Thresholds != nil { in, out := &in.Thresholds, &out.Thresholds *out = make([]Threshold, len(*in)) diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_monitoringdashboards.monitoring.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_monitoringdashboards.monitoring.cnrm.cloud.google.com.yaml index e7163375e2d..abceabd1a49 100644 --- a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_monitoringdashboards.monitoring.cnrm.cloud.google.com.yaml +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_monitoringdashboards.monitoring.cnrm.cloud.google.com.yaml @@ -927,6 +927,11 @@ spec: scorecard: description: A scorecard summarizing time series data. properties: + blankView: + description: Will cause the `Scorecard` to show + only the value, with no indicator to its value + relative to its thresholds. + type: object gaugeView: description: Will cause the scorecard to show a gauge chart. @@ -3844,6 +3849,11 @@ spec: scorecard: description: A scorecard summarizing time series data. properties: + blankView: + description: Will cause the `Scorecard` to show only + the value, with no indicator to its value relative + to its thresholds. + type: object gaugeView: description: Will cause the scorecard to show a gauge chart. @@ -6654,6 +6664,11 @@ spec: scorecard: description: A scorecard summarizing time series data. properties: + blankView: + description: Will cause the `Scorecard` to show + only the value, with no indicator to its value + relative to its thresholds. + type: object gaugeView: description: Will cause the scorecard to show a gauge chart. @@ -9605,6 +9620,11 @@ spec: scorecard: description: A scorecard summarizing time series data. properties: + blankView: + description: Will cause the `Scorecard` to show + only the value, with no indicator to its value + relative to its thresholds. + type: object gaugeView: description: Will cause the scorecard to show a gauge chart. diff --git a/docs/releasenotes/release-1.120.md b/docs/releasenotes/release-1.120.md index 8b2ba839c5b..7aa913649f9 100644 --- a/docs/releasenotes/release-1.120.md +++ b/docs/releasenotes/release-1.120.md @@ -37,6 +37,7 @@ output fields from GCP APIs are in `status.observedState.*` * Added `singleViewGroup` widgets. * Added `timeSeriesTable` widgets. + * Added `blankView` to `scorecard` widgets. * Added `dataSets.targetAxis` and `y2Axis` fields to `xyChart` widgets. * Added `id` field to all widgets. * Added `prometheusQuery` and `outputFullDuration` to timeSeriesQuery. diff --git a/pkg/controller/direct/monitoring/dashboard_generated.mappings.go b/pkg/controller/direct/monitoring/dashboard_generated.mappings.go index 26cd484e201..77642c61dcb 100644 --- a/pkg/controller/direct/monitoring/dashboard_generated.mappings.go +++ b/pkg/controller/direct/monitoring/dashboard_generated.mappings.go @@ -409,7 +409,7 @@ func Scorecard_FromProto(mapCtx *MapContext, in *pb.Scorecard) *krm.Scorecard { out.TimeSeriesQuery = TimeSeriesQuery_FromProto(mapCtx, in.GetTimeSeriesQuery()) out.GaugeView = Scorecard_GaugeView_FromProto(mapCtx, in.GetGaugeView()) out.SparkChartView = Scorecard_SparkChartView_FromProto(mapCtx, in.GetSparkChartView()) - // MISSING: BlankView + out.BlankView = BlankView_FromProto(mapCtx, in.GetBlankView()) out.Thresholds = Slice_FromProto(mapCtx, in.Thresholds, Threshold_FromProto) return out } @@ -425,7 +425,9 @@ func Scorecard_ToProto(mapCtx *MapContext, in *krm.Scorecard) *pb.Scorecard { if oneof := Scorecard_SparkChartView_ToProto(mapCtx, in.SparkChartView); oneof != nil { out.DataView = &pb.Scorecard_SparkChartView_{SparkChartView: oneof} } - // MISSING: BlankView + if oneof := BlankView_ToProto(mapCtx, in.BlankView); oneof != nil { + out.DataView = &pb.Scorecard_BlankView{BlankView: oneof} + } out.Thresholds = Slice_ToProto(mapCtx, in.Thresholds, Threshold_ToProto) return out } diff --git a/pkg/controller/direct/monitoring/dashboard_mappings.go b/pkg/controller/direct/monitoring/dashboard_mappings.go index 5f4266b8f70..c4c29e54310 100644 --- a/pkg/controller/direct/monitoring/dashboard_mappings.go +++ b/pkg/controller/direct/monitoring/dashboard_mappings.go @@ -249,3 +249,18 @@ func DashboardFilter_StringValue_ToProto(mapCtx *MapContext, in *string) *pb.Das out.StringValue = *in return out } + +func BlankView_FromProto(mapCtx *MapContext, in *emptypb.Empty) *krm.BlankView { + if in == nil { + return nil + } + out := &krm.BlankView{} + return out +} +func BlankView_ToProto(mapCtx *MapContext, in *krm.BlankView) *emptypb.Empty { + if in == nil { + return nil + } + out := &emptypb.Empty{} + return out +} diff --git a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_export_monitoringdashboardfull.golden b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_export_monitoringdashboardfull.golden index 1760e4a2756..56f872bdad6 100644 --- a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_export_monitoringdashboardfull.golden +++ b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_export_monitoringdashboardfull.golden @@ -72,6 +72,7 @@ spec: collapsed: true title: CollapsibleGroup Widget - scorecard: + blankView: {} timeSeriesQuery: outputFullDuration: true prometheusQuery: sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} diff --git a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_object_monitoringdashboardfull.golden.yaml b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_object_monitoringdashboardfull.golden.yaml index 7d4b4690f40..eb6c471efef 100644 --- a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_object_monitoringdashboardfull.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_generated_object_monitoringdashboardfull.golden.yaml @@ -79,6 +79,7 @@ spec: collapsed: true title: CollapsibleGroup Widget - scorecard: + blankView: {} timeSeriesQuery: outputFullDuration: true prometheusQuery: sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} diff --git a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_http.log b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_http.log index 25ba95b6ab5..93bb778ac06 100644 --- a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/_http.log @@ -301,6 +301,7 @@ x-goog-request-params: parent=projects%2F${projectId} }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" @@ -546,6 +547,7 @@ X-Xss-Protection: 0 }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" @@ -799,6 +801,7 @@ X-Xss-Protection: 0 }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" @@ -1040,6 +1043,7 @@ x-goog-request-params: dashboard.name=projects%2F${projectId}%2Fdashboards%2Fmon }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" @@ -1285,6 +1289,7 @@ X-Xss-Protection: 0 }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" @@ -1538,6 +1543,7 @@ X-Xss-Protection: 0 }, { "scorecard": { + "blankView": {}, "timeSeriesQuery": { "outputFullDuration": true, "prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)" diff --git a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/create.yaml b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/create.yaml index 95ccd541973..c16a8faaba0 100644 --- a/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/monitoring/v1beta1/monitoringdashboard/monitoringdashboardfull/create.yaml @@ -93,6 +93,7 @@ spec: collapsed: true - title: "Scorecard Widget" scorecard: + blankView: {} timeSeriesQuery: outputFullDuration: true prometheusQuery: "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"