diff --git a/api/hypershift/v1beta1/hosted_controlplane.go b/api/hypershift/v1beta1/hosted_controlplane.go index 8486514f0a18..5e64ed314e6e 100644 --- a/api/hypershift/v1beta1/hosted_controlplane.go +++ b/api/hypershift/v1beta1/hosted_controlplane.go @@ -187,6 +187,13 @@ type HostedControlPlaneSpec struct { // +optional OperatorConfiguration *OperatorConfiguration `json:"operatorConfiguration,omitempty"` + // monitoring configures monitoring for the hosted cluster, including + // forwarding of control plane metrics to the hosted cluster's monitoring stack. + // When omitted, metrics forwarding is not configured and will be inactive. + // + // +optional + Monitoring MonitoringSpec `json:"monitoring,omitzero"` + // imageContentSources lists sources/repositories for the release-image content. // +optional // +kubebuilder:validation:MaxItems=255 diff --git a/api/hypershift/v1beta1/hostedcluster_types.go b/api/hypershift/v1beta1/hostedcluster_types.go index 74b50f24ad38..34e0e1b96485 100644 --- a/api/hypershift/v1beta1/hostedcluster_types.go +++ b/api/hypershift/v1beta1/hostedcluster_types.go @@ -273,6 +273,8 @@ const ( // EnableMetricsForwarding enables metrics forwarding from the management cluster to hosted clusters. // When present, components like the endpoint-resolver and metrics-proxy will be deployed. + // Deprecated: Use spec.monitoring.metricsForwarding instead. This annotation is preserved + // for backward compatibility and will be honored when spec.monitoring is not set. EnableMetricsForwarding = "hypershift.openshift.io/enable-metrics-forwarding" // JSONPatchAnnotation allow modifying the kubevirt VM template using jsonpatch @@ -833,6 +835,15 @@ type HostedClusterSpec struct { // +kubebuilder:default={} // +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Capabilities is immutable. Changes might result in unpredictable and disruptive behavior." Capabilities *Capabilities `json:"capabilities,omitempty"` + + // monitoring configures monitoring for the hosted cluster, including + // forwarding of control plane metrics to the hosted cluster's monitoring stack. + // When omitted, metrics forwarding behavior is determined by the + // hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + // If neither is set, metrics forwarding is disabled. + // + // +optional + Monitoring MonitoringSpec `json:"monitoring,omitzero"` } // OLMCatalogPlacement is an enum specifying the placement of OLM catalog components. @@ -869,6 +880,97 @@ func (olm *OLMCatalogPlacement) Type() string { return "OLMCatalogPlacement" } +// MetricsForwardingMode controls whether metrics forwarding is active for a hosted cluster. +// +// +kubebuilder:validation:Enum=Forward;None +type MetricsForwardingMode string + +const ( + // MetricsForwardingModeForward indicates metrics forwarding is active. + MetricsForwardingModeForward MetricsForwardingMode = "Forward" + + // MetricsForwardingModeNone indicates metrics forwarding is inactive. + MetricsForwardingModeNone MetricsForwardingMode = "None" +) + +// MetricsSet specifies the set of metrics to collect and forward from hosted clusters. +// +// +kubebuilder:validation:Enum=Telemetry;SRE;All +type MetricsSet string + +const ( + // MetricsSetTelemetry collects only the minimal set of metrics required for + // OpenShift Telemetry. Use this to minimize metrics volume while still + // satisfying cluster telemetry requirements. + MetricsSetTelemetry MetricsSet = "Telemetry" + + // MetricsSetSRE collects the metrics defined in the sre-metric-set ConfigMap, + // which includes the Telemetry set plus additional metrics needed for SRE + // monitoring dashboards and alerts. Use this for clusters that require + // SRE observability. + MetricsSetSRE MetricsSet = "SRE" + + // MetricsSetAll collects all metrics from control plane components without + // any filtering. Use this for debugging or when full metric visibility is + // needed, but be aware it produces significantly higher metrics volume. + MetricsSetAll MetricsSet = "All" +) + +// MonitoringSpec configures monitoring for the hosted cluster. +// At least one field must be specified when this struct is present. +// +// +kubebuilder:validation:MinProperties=1 +type MonitoringSpec struct { + // metricsForwarding configures forwarding of control plane metrics into + // the hosted cluster's monitoring stack. + // When omitted, metrics forwarding behavior is determined by the + // hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + // If neither is set, metrics forwarding is disabled. + // + // +optional + MetricsForwarding MetricsForwardingSpec `json:"metricsForwarding,omitzero"` + + // metricsSet specifies which set of metrics to collect and forward. + // This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + // When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + // + // "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + // "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + // needed for SRE dashboards and alerts. + // "All" collects all metrics from control plane components without filtering, + // which produces significantly higher metrics volume. + // + // +optional + MetricsSet MetricsSet `json:"metricsSet,omitempty"` +} + +// MetricsForwardingSpec configures metrics forwarding for the hosted cluster. +type MetricsForwardingSpec struct { + // mode controls whether metrics forwarding is active for this hosted cluster. + // When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + // control plane, and a metrics-forwarder is deployed in the hosted cluster. + // When set to "None", metrics forwarding is inactive. + // + // +required + Mode MetricsForwardingMode `json:"mode,omitempty"` + + // metricsSet specifies which set of metrics to forward to the hosted + // cluster's monitoring stack. This controls only the metrics-proxy forwarding + // path and does not affect management-cluster-side ServiceMonitor/PodMonitor + // relabel configurations. + // When not specified, the value from monitoring.metricsSet is used, which itself + // falls back to the global METRICS_SET environment variable (default "Telemetry"). + // + // "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + // "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + // ConfigMap, needed for SRE dashboards and alerts. + // "All" forwards all metrics from control plane components without filtering, + // which produces significantly higher metrics volume. + // + // +optional + MetricsSet MetricsSet `json:"metricsSet,omitempty"` +} + // ImageContentSource specifies image mirrors that can be used by cluster nodes // to pull content. For cluster workloads, if a container image registry host of // the pullspec matches Source then one of the Mirrors are substituted as hosts diff --git a/api/hypershift/v1beta1/zz_generated.deepcopy.go b/api/hypershift/v1beta1/zz_generated.deepcopy.go index 454f86378499..5a2726d43b69 100644 --- a/api/hypershift/v1beta1/zz_generated.deepcopy.go +++ b/api/hypershift/v1beta1/zz_generated.deepcopy.go @@ -2406,6 +2406,7 @@ func (in *HostedClusterSpec) DeepCopyInto(out *HostedClusterSpec) { *out = new(Capabilities) (*in).DeepCopyInto(*out) } + out.Monitoring = in.Monitoring } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostedClusterSpec. @@ -2578,6 +2579,7 @@ func (in *HostedControlPlaneSpec) DeepCopyInto(out *HostedControlPlaneSpec) { *out = new(OperatorConfiguration) (*in).DeepCopyInto(*out) } + out.Monitoring = in.Monitoring if in.ImageContentSources != nil { in, out := &in.ImageContentSources, &out.ImageContentSources *out = make([]ImageContentSource, len(*in)) @@ -3428,6 +3430,37 @@ func (in *ManagedIdentity) DeepCopy() *ManagedIdentity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricsForwardingSpec) DeepCopyInto(out *MetricsForwardingSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsForwardingSpec. +func (in *MetricsForwardingSpec) DeepCopy() *MetricsForwardingSpec { + if in == nil { + return nil + } + out := new(MetricsForwardingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringSpec) DeepCopyInto(out *MonitoringSpec) { + *out = *in + out.MetricsForwarding = in.MetricsForwarding +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringSpec. +func (in *MonitoringSpec) DeepCopy() *MonitoringSpec { + if in == nil { + return nil + } + out := new(MonitoringSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkFilter) DeepCopyInto(out *NetworkFilter) { *out = *in diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml index 4ed2391e13e2..7452c17d2a65 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml @@ -2877,6 +2877,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml index 9185fb00d932..ad462d7060f0 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml @@ -2868,6 +2868,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml index 2269797a21d4..fb947c8082ee 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml @@ -2868,6 +2868,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml index 0a1a136fa308..f3602a64f41e 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml @@ -3200,6 +3200,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml index cebc53316acf..2566cada52a0 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml @@ -3340,6 +3340,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml index 1270fd8cb1fb..4d267c58ff99 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml @@ -3331,6 +3331,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml index f7170ecada7a..7b83155c52dd 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml @@ -2868,6 +2868,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HCPEtcdBackup.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HCPEtcdBackup.yaml index fd458cb1f13b..05aa3177907a 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HCPEtcdBackup.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HCPEtcdBackup.yaml @@ -2933,6 +2933,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml index 461ae7dc7982..d42dac284827 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml @@ -2890,6 +2890,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml index f741a117e78b..ea3859708d46 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml @@ -2886,6 +2886,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml index 33c70e1bc312..3718dd799608 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml @@ -2944,6 +2944,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml index bdb6610a9248..b3113074eee9 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml @@ -2868,6 +2868,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/TLSAdherence.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/TLSAdherence.yaml index 517516cd2f4a..62148a4bc430 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/TLSAdherence.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/TLSAdherence.yaml @@ -2908,6 +2908,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml index 7faf853bd178..34a91881f744 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/AAA_ungated.yaml @@ -2779,6 +2779,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml index 927f2b9ffc23..0bdd9e374014 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml @@ -2770,6 +2770,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml index ad6e7742c0ec..aa7487320fe0 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml @@ -2770,6 +2770,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml index 1b9da7de5255..5a43b32e0d41 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDC.yaml @@ -3102,6 +3102,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml index 3cd3503473be..b8a1505b0289 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml @@ -3242,6 +3242,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml index 9d7a73cb3bf0..b9829fda7a71 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml @@ -3233,6 +3233,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml index 1527b355549f..45abaf2ec80f 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/GCPPlatform.yaml @@ -2770,6 +2770,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HCPEtcdBackup.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HCPEtcdBackup.yaml index 36a11500968d..888e2fd95207 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HCPEtcdBackup.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HCPEtcdBackup.yaml @@ -2835,6 +2835,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml index 5ea38844b584..95ca7cdf6717 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml @@ -2792,6 +2792,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml index 9de4ad90ead5..e8735b79278f 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/ImageStreamImportMode.yaml @@ -2788,6 +2788,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml index db3f3840a8c2..d31550b25777 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/KMSEncryptionProvider.yaml @@ -2846,6 +2846,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml index c3c0b64fcf23..a8b02c4d9b35 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/OpenStack.yaml @@ -2770,6 +2770,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/TLSAdherence.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/TLSAdherence.yaml index e52cbe485e19..b8c939a5fdb1 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/TLSAdherence.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedcontrolplanes.hypershift.openshift.io/TLSAdherence.yaml @@ -2810,6 +2810,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/client/applyconfiguration/hypershift/v1beta1/hostedclusterspec.go b/client/applyconfiguration/hypershift/v1beta1/hostedclusterspec.go index 4f13f8c36935..62eaf6849716 100644 --- a/client/applyconfiguration/hypershift/v1beta1/hostedclusterspec.go +++ b/client/applyconfiguration/hypershift/v1beta1/hostedclusterspec.go @@ -59,6 +59,7 @@ type HostedClusterSpecApplyConfiguration struct { Tolerations []corev1.Toleration `json:"tolerations,omitempty"` Labels map[string]string `json:"labels,omitempty"` Capabilities *CapabilitiesApplyConfiguration `json:"capabilities,omitempty"` + Monitoring *MonitoringSpecApplyConfiguration `json:"monitoring,omitempty"` } // HostedClusterSpecApplyConfiguration constructs a declarative configuration of the HostedClusterSpec type for use with @@ -354,3 +355,11 @@ func (b *HostedClusterSpecApplyConfiguration) WithCapabilities(value *Capabiliti b.Capabilities = value return b } + +// WithMonitoring sets the Monitoring field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Monitoring field is set to the value of the last call. +func (b *HostedClusterSpecApplyConfiguration) WithMonitoring(value *MonitoringSpecApplyConfiguration) *HostedClusterSpecApplyConfiguration { + b.Monitoring = value + return b +} diff --git a/client/applyconfiguration/hypershift/v1beta1/hostedcontrolplanespec.go b/client/applyconfiguration/hypershift/v1beta1/hostedcontrolplanespec.go index e1387bb9f9f9..07dd37ef521d 100644 --- a/client/applyconfiguration/hypershift/v1beta1/hostedcontrolplanespec.go +++ b/client/applyconfiguration/hypershift/v1beta1/hostedcontrolplanespec.go @@ -49,6 +49,7 @@ type HostedControlPlaneSpecApplyConfiguration struct { Etcd *EtcdSpecApplyConfiguration `json:"etcd,omitempty"` Configuration *ClusterConfigurationApplyConfiguration `json:"configuration,omitempty"` OperatorConfiguration *OperatorConfigurationApplyConfiguration `json:"operatorConfiguration,omitempty"` + Monitoring *MonitoringSpecApplyConfiguration `json:"monitoring,omitempty"` ImageContentSources []ImageContentSourceApplyConfiguration `json:"imageContentSources,omitempty"` AdditionalTrustBundle *corev1.LocalObjectReference `json:"additionalTrustBundle,omitempty"` SecretEncryption *SecretEncryptionSpecApplyConfiguration `json:"secretEncryption,omitempty"` @@ -257,6 +258,14 @@ func (b *HostedControlPlaneSpecApplyConfiguration) WithOperatorConfiguration(val return b } +// WithMonitoring sets the Monitoring field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Monitoring field is set to the value of the last call. +func (b *HostedControlPlaneSpecApplyConfiguration) WithMonitoring(value *MonitoringSpecApplyConfiguration) *HostedControlPlaneSpecApplyConfiguration { + b.Monitoring = value + return b +} + // WithImageContentSources adds the given value to the ImageContentSources field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the ImageContentSources field. diff --git a/client/applyconfiguration/hypershift/v1beta1/metricsforwardingspec.go b/client/applyconfiguration/hypershift/v1beta1/metricsforwardingspec.go new file mode 100644 index 000000000000..9d3d57109691 --- /dev/null +++ b/client/applyconfiguration/hypershift/v1beta1/metricsforwardingspec.go @@ -0,0 +1,51 @@ +/* + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + hypershiftv1beta1 "github.com/openshift/hypershift/api/hypershift/v1beta1" +) + +// MetricsForwardingSpecApplyConfiguration represents a declarative configuration of the MetricsForwardingSpec type for use +// with apply. +type MetricsForwardingSpecApplyConfiguration struct { + Mode *hypershiftv1beta1.MetricsForwardingMode `json:"mode,omitempty"` + MetricsSet *hypershiftv1beta1.MetricsSet `json:"metricsSet,omitempty"` +} + +// MetricsForwardingSpecApplyConfiguration constructs a declarative configuration of the MetricsForwardingSpec type for use with +// apply. +func MetricsForwardingSpec() *MetricsForwardingSpecApplyConfiguration { + return &MetricsForwardingSpecApplyConfiguration{} +} + +// WithMode sets the Mode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Mode field is set to the value of the last call. +func (b *MetricsForwardingSpecApplyConfiguration) WithMode(value hypershiftv1beta1.MetricsForwardingMode) *MetricsForwardingSpecApplyConfiguration { + b.Mode = &value + return b +} + +// WithMetricsSet sets the MetricsSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MetricsSet field is set to the value of the last call. +func (b *MetricsForwardingSpecApplyConfiguration) WithMetricsSet(value hypershiftv1beta1.MetricsSet) *MetricsForwardingSpecApplyConfiguration { + b.MetricsSet = &value + return b +} diff --git a/client/applyconfiguration/hypershift/v1beta1/monitoringspec.go b/client/applyconfiguration/hypershift/v1beta1/monitoringspec.go new file mode 100644 index 000000000000..9aa62943f4ad --- /dev/null +++ b/client/applyconfiguration/hypershift/v1beta1/monitoringspec.go @@ -0,0 +1,51 @@ +/* + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + hypershiftv1beta1 "github.com/openshift/hypershift/api/hypershift/v1beta1" +) + +// MonitoringSpecApplyConfiguration represents a declarative configuration of the MonitoringSpec type for use +// with apply. +type MonitoringSpecApplyConfiguration struct { + MetricsForwarding *MetricsForwardingSpecApplyConfiguration `json:"metricsForwarding,omitempty"` + MetricsSet *hypershiftv1beta1.MetricsSet `json:"metricsSet,omitempty"` +} + +// MonitoringSpecApplyConfiguration constructs a declarative configuration of the MonitoringSpec type for use with +// apply. +func MonitoringSpec() *MonitoringSpecApplyConfiguration { + return &MonitoringSpecApplyConfiguration{} +} + +// WithMetricsForwarding sets the MetricsForwarding field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MetricsForwarding field is set to the value of the last call. +func (b *MonitoringSpecApplyConfiguration) WithMetricsForwarding(value *MetricsForwardingSpecApplyConfiguration) *MonitoringSpecApplyConfiguration { + b.MetricsForwarding = value + return b +} + +// WithMetricsSet sets the MetricsSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MetricsSet field is set to the value of the last call. +func (b *MonitoringSpecApplyConfiguration) WithMetricsSet(value hypershiftv1beta1.MetricsSet) *MonitoringSpecApplyConfiguration { + b.MetricsSet = &value + return b +} diff --git a/client/applyconfiguration/utils.go b/client/applyconfiguration/utils.go index 5464e88f8024..6c1a03d6935d 100644 --- a/client/applyconfiguration/utils.go +++ b/client/applyconfiguration/utils.go @@ -313,6 +313,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &hypershiftv1beta1.ManagedEtcdStorageSpecApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("ManagedIdentity"): return &hypershiftv1beta1.ManagedIdentityApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MetricsForwardingSpec"): + return &hypershiftv1beta1.MetricsForwardingSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MonitoringSpec"): + return &hypershiftv1beta1.MonitoringSpecApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("NetworkFilter"): return &hypershiftv1beta1.NetworkFilterApplyConfiguration{} case v1beta1.SchemeGroupVersion.WithKind("NetworkParam"): diff --git a/cmd/install/assets/crds/hypershift-operator/tests/hostedclusters.hypershift.openshift.io/stable.hostedclusters.monitoring.testsuite.yaml b/cmd/install/assets/crds/hypershift-operator/tests/hostedclusters.hypershift.openshift.io/stable.hostedclusters.monitoring.testsuite.yaml new file mode 100644 index 000000000000..ccdd069d6845 --- /dev/null +++ b/cmd/install/assets/crds/hypershift-operator/tests/hostedclusters.hypershift.openshift.io/stable.hostedclusters.monitoring.testsuite.yaml @@ -0,0 +1,442 @@ +apiVersion: apiextensions.k8s.io/v1 +name: "HostedCluster monitoring validation" +crdName: hostedclusters.hypershift.openshift.io +version: v1beta1 +tests: + onCreate: + - name: When monitoring is omitted it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsForwarding mode is Forward it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsForwarding mode is None it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: None + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsSet is Telemetry it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: Telemetry + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsSet is SRE it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: SRE + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsSet is All it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: All + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsSet is an invalid value it should fail + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: InvalidValue + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + expectedError: "spec.monitoring.metricsSet" + + - name: When mode is an invalid value it should fail + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: InvalidMode + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + expectedError: "spec.monitoring.metricsForwarding.mode" + + - name: When metricsForwarding has metricsSet SRE it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: SRE + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsForwarding metricsSet differs from monitoring metricsSet it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: All + metricsSet: Telemetry + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + + - name: When metricsForwarding has an invalid metricsSet it should fail + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: HostedCluster + spec: + monitoring: + metricsForwarding: + mode: Forward + metricsSet: InvalidValue + dns: + baseDomain: example.com + platform: + type: AWS + pullSecret: + name: secret + release: + image: quay.io/openshift-release-dev/ocp-release:4.15.11-x86_64 + secretEncryption: + aescbc: + activeKey: + name: key + type: aescbc + services: + - service: APIServer + servicePublishingStrategy: + type: Route + route: {} + - service: OAuthServer + servicePublishingStrategy: + type: Route + route: {} + - service: Konnectivity + servicePublishingStrategy: + type: Route + route: {} + - service: Ignition + servicePublishingStrategy: + type: Route + route: {} + expectedError: "spec.monitoring.metricsForwarding.metricsSet" diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml index d406b89a759f..e2c55e308aa7 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml @@ -3699,6 +3699,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-Default.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-Default.crd.yaml index bbafc3f882a8..193f86b4c76a 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-Default.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-Default.crd.yaml @@ -3369,6 +3369,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml index 30d17382b0f8..aaab26b4af7d 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml @@ -3570,6 +3570,72 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: default: clusterNetwork: diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-CustomNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-CustomNoUpgrade.crd.yaml index 798d4f0664f8..f86b306f72f1 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-CustomNoUpgrade.crd.yaml @@ -3601,6 +3601,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-Default.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-Default.crd.yaml index 5fd583a45ffa..c6497612b772 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-Default.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-Default.crd.yaml @@ -3271,6 +3271,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-TechPreviewNoUpgrade.crd.yaml index 25068f5cf7f6..40e9b29ad38f 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedcontrolplanes-Hypershift-TechPreviewNoUpgrade.crd.yaml @@ -3472,6 +3472,70 @@ spec: -kubebuilder:validation:XValidation:rule=`self.all(key, size(self[key]) <= 63 && self[key].matches('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$'))`, message="label value must be 63 characters or less (can be empty), consist of alphanumeric characters, dashes (-), underscores (_) or dots (.), and begin and end with an alphanumeric character" maxProperties: 20 type: object + monitoring: + description: |- + monitoring configures monitoring for the hosted cluster, including + forwarding of control plane metrics to the hosted cluster's monitoring stack. + When omitted, metrics forwarding is not configured and will be inactive. + minProperties: 1 + properties: + metricsForwarding: + description: |- + metricsForwarding configures forwarding of control plane metrics into + the hosted cluster's monitoring stack. + When omitted, metrics forwarding behavior is determined by the + hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + If neither is set, metrics forwarding is disabled. + properties: + metricsSet: + description: |- + metricsSet specifies which set of metrics to forward to the hosted + cluster's monitoring stack. This controls only the metrics-proxy forwarding + path and does not affect management-cluster-side ServiceMonitor/PodMonitor + relabel configurations. + When not specified, the value from monitoring.metricsSet is used, which itself + falls back to the global METRICS_SET environment variable (default "Telemetry"). + + "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + ConfigMap, needed for SRE dashboards and alerts. + "All" forwards all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + mode: + description: |- + mode controls whether metrics forwarding is active for this hosted cluster. + When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + control plane, and a metrics-forwarder is deployed in the hosted cluster. + When set to "None", metrics forwarding is inactive. + enum: + - Forward + - None + type: string + required: + - mode + type: object + metricsSet: + description: |- + metricsSet specifies which set of metrics to collect and forward. + This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + + "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + needed for SRE dashboards and alerts. + "All" collects all metrics from control plane components without filtering, + which produces significantly higher metrics volume. + enum: + - Telemetry + - SRE + - All + type: string + type: object networking: description: |- networking specifies network configuration for the cluster. diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component.go b/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component.go index 0f0efdc35ddc..940ff11f3fbf 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component.go @@ -27,7 +27,7 @@ func (r *endpointResolver) NeedsManagementKASAccess() bool { func NewComponent() component.ControlPlaneComponent { return component.NewDeploymentComponent(ComponentName, &endpointResolver{}). - WithPredicate(predicate). + WithPredicate(Predicate). WithManifestAdapter( "ca-cert.yaml", component.WithAdaptFunction(adaptCACertSecret), @@ -43,8 +43,7 @@ func NewComponent() component.ControlPlaneComponent { Build() } -func predicate(cpContext component.WorkloadContext) (bool, error) { +func Predicate(cpContext component.WorkloadContext) (bool, error) { _, disableMonitoring := cpContext.HCP.Annotations[hyperv1.DisableMonitoringServices] - _, enableMetricsForwarding := cpContext.HCP.Annotations[hyperv1.EnableMetricsForwarding] - return !disableMonitoring && enableMetricsForwarding, nil + return !disableMonitoring && cpContext.HCP.Spec.Monitoring.MetricsForwarding.Mode == hyperv1.MetricsForwardingModeForward, nil } diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component_test.go b/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component_test.go index 3bb96360d08c..f1c721f083f0 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component_test.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/endpoint_resolver/component_test.go @@ -18,32 +18,39 @@ func TestPredicate(t *testing.T) { tests := []struct { name string annotations map[string]string + monitoring hyperv1.MonitoringSpec expected bool }{ { - name: "When both annotations are absent, it should return false", + name: "When metrics forwarding mode is not set, it should return false", annotations: map[string]string{}, expected: false, }, { - name: "When only DisableMonitoringServices is present, it should return false", - annotations: map[string]string{ - hyperv1.DisableMonitoringServices: "true", + name: "When DisableMonitoringServices is set, it should return false even if forwarding is enabled", + annotations: map[string]string{hyperv1.DisableMonitoringServices: "true"}, + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, }, expected: false, }, { - name: "When only EnableMetricsForwarding is present, it should return true", - annotations: map[string]string{ - hyperv1.EnableMetricsForwarding: "true", + name: "When metrics forwarding mode is Enabled, it should return true", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, }, expected: true, }, { - name: "When both annotations are present, it should return false", - annotations: map[string]string{ - hyperv1.DisableMonitoringServices: "true", - hyperv1.EnableMetricsForwarding: "true", + name: "When metrics forwarding mode is Disabled, it should return false", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeNone, + }, }, expected: false, }, @@ -58,6 +65,9 @@ func TestPredicate(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Annotations: tc.annotations, }, + Spec: hyperv1.HostedControlPlaneSpec{ + Monitoring: tc.monitoring, + }, } cpContext := component.WorkloadContext{ @@ -65,7 +75,7 @@ func TestPredicate(t *testing.T) { HCP: hcp, } - result, err := predicate(cpContext) + result, err := Predicate(cpContext) g.Expect(err).ToNot(HaveOccurred()) g.Expect(result).To(Equal(tc.expected)) }) diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/component.go b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/component.go index 832f49d327fb..0f56505f57d1 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/component.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/component.go @@ -38,7 +38,7 @@ func NewComponent(defaultIngressDomain string) component.ControlPlaneComponent { return component.NewDeploymentComponent(ComponentName, mp). WithAdaptFunction(adaptDeployment). - WithPredicate(predicate). + WithPredicate(endpointresolverv2.Predicate). WithManifestAdapter( "service.yaml", ). @@ -65,9 +65,3 @@ func NewComponent(defaultIngressDomain string) component.ControlPlaneComponent { WithDependencies(endpointresolverv2.ComponentName). Build() } - -func predicate(cpContext component.WorkloadContext) (bool, error) { - _, disableMonitoring := cpContext.HCP.Annotations[hyperv1.DisableMonitoringServices] - _, enableMetricsForwarding := cpContext.HCP.Annotations[hyperv1.EnableMetricsForwarding] - return !disableMonitoring && enableMetricsForwarding, nil -} diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment.go b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment.go index 5b368e4db42f..8a295ec1cde0 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment.go @@ -20,6 +20,9 @@ import ( func adaptDeployment(cpContext component.WorkloadContext, deployment *appsv1.Deployment) error { metricsSet := cpContext.MetricsSet + if fwdSet := cpContext.HCP.Spec.Monitoring.MetricsForwarding.MetricsSet; fwdSet != "" { + metricsSet = metrics.MetricsSet(fwdSet) + } if metricsSet == "" { metricsSet = metrics.MetricsSetAll } diff --git a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment_test.go b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment_test.go index c1ddb5fcbe40..14959578dfa1 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment_test.go +++ b/control-plane-operator/controllers/hostedcontrolplane/v2/metrics_proxy/deployment_test.go @@ -4,9 +4,13 @@ import ( "context" "testing" + . "github.com/onsi/gomega" + hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1" component "github.com/openshift/hypershift/support/controlplane-component" + "github.com/openshift/hypershift/support/metrics" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -484,3 +488,94 @@ func TestCertVolumeOptionalFlag(t *testing.T) { } }) } + +func TestAdaptDeployment_MetricsSetOverride(t *testing.T) { + t.Parallel() + + namespace := "clusters-test" + scheme := runtime.NewScheme() + _ = corev1.AddToScheme(scheme) + _ = prometheusoperatorv1.AddToScheme(scheme) + + baseDeployment := func() *appsv1.Deployment { + return &appsv1.Deployment{ + Spec: appsv1.DeploymentSpec{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + {Name: ComponentName}, + }, + }, + }, + }, + } + } + + metricsSetArg := func(dep *appsv1.Deployment) string { + for _, c := range dep.Spec.Template.Spec.Containers { + if c.Name == ComponentName { + for i, arg := range c.Args { + if arg == "--metrics-set" && i+1 < len(c.Args) { + return c.Args[i+1] + } + } + } + } + return "" + } + + tests := []struct { + name string + contextMetricsSet metrics.MetricsSet + forwardingSet hyperv1.MetricsSet + expectedMetricsSet string + }{ + { + name: "When MetricsForwarding.MetricsSet is set it should override cpContext.MetricsSet", + contextMetricsSet: metrics.MetricsSetTelemetry, + forwardingSet: hyperv1.MetricsSetAll, + expectedMetricsSet: string(metrics.MetricsSetAll), + }, + { + name: "When MetricsForwarding.MetricsSet is empty it should use cpContext.MetricsSet", + contextMetricsSet: metrics.MetricsSetSRE, + forwardingSet: "", + expectedMetricsSet: string(metrics.MetricsSetSRE), + }, + { + name: "When both MetricsForwarding.MetricsSet and cpContext.MetricsSet are empty it should default to All", + contextMetricsSet: "", + forwardingSet: "", + expectedMetricsSet: string(metrics.MetricsSetAll), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + g := NewWithT(t) + + fakeClient := fake.NewClientBuilder().WithScheme(scheme).Build() + cpContext := component.WorkloadContext{ + Context: context.Background(), + Client: fakeClient, + MetricsSet: tt.contextMetricsSet, + HCP: &hyperv1.HostedControlPlane{ + ObjectMeta: metav1.ObjectMeta{Namespace: namespace}, + Spec: hyperv1.HostedControlPlaneSpec{ + Monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + MetricsSet: tt.forwardingSet, + }, + }, + }, + }, + } + + dep := baseDeployment() + err := adaptDeployment(cpContext, dep) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(metricsSetArg(dep)).To(Equal(tt.expectedMetricsSet)) + }) + } +} diff --git a/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go b/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go index 122b46d8c1c8..858416c41553 100644 --- a/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go +++ b/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go @@ -971,7 +971,7 @@ func (r *reconciler) reconcileMetricsForwarder(ctx context.Context, hcp *hyperv1 if _, disabled := hcp.Annotations[hyperv1.DisableMonitoringServices]; disabled { return k8sutil.DeleteAllIfNeeded(ctx, r.client, deployment, cm, servingCA, podMonitor) } - if _, enabled := hcp.Annotations[hyperv1.EnableMetricsForwarding]; !enabled { + if hcp.Spec.Monitoring.MetricsForwarding.Mode != hyperv1.MetricsForwardingModeForward { return k8sutil.DeleteAllIfNeeded(ctx, r.client, deployment, cm, servingCA, podMonitor) } diff --git a/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go b/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go index 8e1c5de8e352..32c34373e355 100644 --- a/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go +++ b/control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go @@ -3087,11 +3087,12 @@ func TestReconcileMetricsForwarder(t *testing.T) { tests := []struct { name string annotations map[string]string + monitoring hyperv1.MonitoringSpec existingObjects []client.Object expectCleanup bool }{ { - name: "When EnableMetricsForwarding is not set, it should delete existing resources", + name: "When metrics forwarding mode is not set, it should delete existing resources", annotations: map[string]string{}, existingObjects: []client.Object{ manifests.MetricsForwarderDeployment(), @@ -3104,6 +3105,11 @@ func TestReconcileMetricsForwarder(t *testing.T) { { name: "When DisableMonitoringServices is set, it should delete existing resources", annotations: map[string]string{hyperv1.DisableMonitoringServices: "true"}, + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + }, existingObjects: []client.Object{ manifests.MetricsForwarderDeployment(), manifests.MetricsForwarderConfigMap(), @@ -3113,11 +3119,26 @@ func TestReconcileMetricsForwarder(t *testing.T) { expectCleanup: true, }, { - name: "When EnableMetricsForwarding is not set and no resources exist, it should succeed", + name: "When metrics forwarding mode is not set and no resources exist, it should succeed", annotations: map[string]string{}, existingObjects: nil, expectCleanup: true, }, + { + name: "When metrics forwarding mode is Disabled, it should delete existing resources", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeNone, + }, + }, + existingObjects: []client.Object{ + manifests.MetricsForwarderDeployment(), + manifests.MetricsForwarderConfigMap(), + manifests.MetricsForwarderServingCA(), + manifests.MetricsForwarderPodMonitor(), + }, + expectCleanup: true, + }, } for _, tt := range tests { @@ -3136,6 +3157,9 @@ func TestReconcileMetricsForwarder(t *testing.T) { Namespace: "test-ns", Annotations: tt.annotations, }, + Spec: hyperv1.HostedControlPlaneSpec{ + Monitoring: tt.monitoring, + }, } err := r.reconcileMetricsForwarder(t.Context(), hcp, nil) diff --git a/docs/content/reference/aggregated-docs.md b/docs/content/reference/aggregated-docs.md index 7bd015321b29..d14937da883c 100644 --- a/docs/content/reference/aggregated-docs.md +++ b/docs/content/reference/aggregated-docs.md @@ -36735,6 +36735,24 @@ Capabilities This field is optional and once set cannot be changed.

+ + +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+ + @@ -45135,6 +45153,24 @@ Capabilities This field is optional and once set cannot be changed.

+ + +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+ + ###HostedClusterStatus { #hypershift.openshift.io/v1beta1.HostedClusterStatus } @@ -45704,6 +45740,22 @@ OperatorConfiguration +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding is not configured and will be inactive.

+ + + + imageContentSources
@@ -48303,6 +48355,180 @@ Spot instances use spare EC2 capacity at reduced prices but may be interrupted.< +###MetricsForwardingMode { #hypershift.openshift.io/v1beta1.MetricsForwardingMode } +

+(Appears on: +MetricsForwardingSpec) +

+

+

MetricsForwardingMode controls whether metrics forwarding is active for a hosted cluster.

+

+ + + + + + + + + + + + +
ValueDescription

"Forward"

MetricsForwardingModeForward indicates metrics forwarding is active.

+

"None"

MetricsForwardingModeNone indicates metrics forwarding is inactive.

+
+###MetricsForwardingSpec { #hypershift.openshift.io/v1beta1.MetricsForwardingSpec } +

+(Appears on: +MonitoringSpec) +

+

+

MetricsForwardingSpec configures metrics forwarding for the hosted cluster.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+mode
+ + +MetricsForwardingMode + + +
+

mode controls whether metrics forwarding is active for this hosted cluster. +When set to “Forward”, metrics-proxy and endpoint-resolver are deployed in the +control plane, and a metrics-forwarder is deployed in the hosted cluster. +When set to “None”, metrics forwarding is inactive.

+
+metricsSet
+ + +MetricsSet + + +
+(Optional) +

metricsSet specifies which set of metrics to forward to the hosted +cluster’s monitoring stack. This controls only the metrics-proxy forwarding +path and does not affect management-cluster-side ServiceMonitor/PodMonitor +relabel configurations. +When not specified, the value from monitoring.metricsSet is used, which itself +falls back to the global METRICS_SET environment variable (default “Telemetry”).

+

“Telemetry” forwards only the minimal set of metrics required for OpenShift Telemetry. +“SRE” forwards the Telemetry set plus additional metrics defined in the sre-metric-set +ConfigMap, needed for SRE dashboards and alerts. +“All” forwards all metrics from control plane components without filtering, +which produces significantly higher metrics volume.

+
+###MetricsSet { #hypershift.openshift.io/v1beta1.MetricsSet } +

+(Appears on: +MetricsForwardingSpec, +MonitoringSpec) +

+

+

MetricsSet specifies the set of metrics to collect and forward from hosted clusters.

+

+ + + + + + + + + + + + + + +
ValueDescription

"All"

MetricsSetAll collects all metrics from control plane components without +any filtering. Use this for debugging or when full metric visibility is +needed, but be aware it produces significantly higher metrics volume.

+

"SRE"

MetricsSetSRE collects the metrics defined in the sre-metric-set ConfigMap, +which includes the Telemetry set plus additional metrics needed for SRE +monitoring dashboards and alerts. Use this for clusters that require +SRE observability.

+

"Telemetry"

MetricsSetTelemetry collects only the minimal set of metrics required for +OpenShift Telemetry. Use this to minimize metrics volume while still +satisfying cluster telemetry requirements.

+
+###MonitoringSpec { #hypershift.openshift.io/v1beta1.MonitoringSpec } +

+(Appears on: +HostedClusterSpec, +HostedControlPlaneSpec) +

+

+

MonitoringSpec configures monitoring for the hosted cluster. +At least one field must be specified when this struct is present.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+metricsForwarding,omitzero
+ + +MetricsForwardingSpec + + +
+(Optional) +

metricsForwarding configures forwarding of control plane metrics into +the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+
+metricsSet
+ + +MetricsSet + + +
+(Optional) +

metricsSet specifies which set of metrics to collect and forward. +This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. +When not specified, the global METRICS_SET value is used, which defaults to “Telemetry”.

+

“Telemetry” collects only the minimal set of metrics required for OpenShift Telemetry. +“SRE” collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, +needed for SRE dashboards and alerts. +“All” collects all metrics from control plane components without filtering, +which produces significantly higher metrics volume.

+
###MultiQueueSetting { #hypershift.openshift.io/v1beta1.MultiQueueSetting }

(Appears on: diff --git a/docs/content/reference/api.md b/docs/content/reference/api.md index fb4fb96c1b20..342edcb96ed0 100644 --- a/docs/content/reference/api.md +++ b/docs/content/reference/api.md @@ -1004,6 +1004,24 @@ Capabilities This field is optional and once set cannot be changed.

+ + +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+ + @@ -9404,6 +9422,24 @@ Capabilities This field is optional and once set cannot be changed.

+ + +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+ + ###HostedClusterStatus { #hypershift.openshift.io/v1beta1.HostedClusterStatus } @@ -9973,6 +10009,22 @@ OperatorConfiguration +monitoring,omitzero
+ + +MonitoringSpec + + + + +(Optional) +

monitoring configures monitoring for the hosted cluster, including +forwarding of control plane metrics to the hosted cluster’s monitoring stack. +When omitted, metrics forwarding is not configured and will be inactive.

+ + + + imageContentSources
@@ -12572,6 +12624,180 @@ Spot instances use spare EC2 capacity at reduced prices but may be interrupted.< +###MetricsForwardingMode { #hypershift.openshift.io/v1beta1.MetricsForwardingMode } +

+(Appears on: +MetricsForwardingSpec) +

+

+

MetricsForwardingMode controls whether metrics forwarding is active for a hosted cluster.

+

+ + + + + + + + + + + + +
ValueDescription

"Forward"

MetricsForwardingModeForward indicates metrics forwarding is active.

+

"None"

MetricsForwardingModeNone indicates metrics forwarding is inactive.

+
+###MetricsForwardingSpec { #hypershift.openshift.io/v1beta1.MetricsForwardingSpec } +

+(Appears on: +MonitoringSpec) +

+

+

MetricsForwardingSpec configures metrics forwarding for the hosted cluster.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+mode
+ + +MetricsForwardingMode + + +
+

mode controls whether metrics forwarding is active for this hosted cluster. +When set to “Forward”, metrics-proxy and endpoint-resolver are deployed in the +control plane, and a metrics-forwarder is deployed in the hosted cluster. +When set to “None”, metrics forwarding is inactive.

+
+metricsSet
+ + +MetricsSet + + +
+(Optional) +

metricsSet specifies which set of metrics to forward to the hosted +cluster’s monitoring stack. This controls only the metrics-proxy forwarding +path and does not affect management-cluster-side ServiceMonitor/PodMonitor +relabel configurations. +When not specified, the value from monitoring.metricsSet is used, which itself +falls back to the global METRICS_SET environment variable (default “Telemetry”).

+

“Telemetry” forwards only the minimal set of metrics required for OpenShift Telemetry. +“SRE” forwards the Telemetry set plus additional metrics defined in the sre-metric-set +ConfigMap, needed for SRE dashboards and alerts. +“All” forwards all metrics from control plane components without filtering, +which produces significantly higher metrics volume.

+
+###MetricsSet { #hypershift.openshift.io/v1beta1.MetricsSet } +

+(Appears on: +MetricsForwardingSpec, +MonitoringSpec) +

+

+

MetricsSet specifies the set of metrics to collect and forward from hosted clusters.

+

+ + + + + + + + + + + + + + +
ValueDescription

"All"

MetricsSetAll collects all metrics from control plane components without +any filtering. Use this for debugging or when full metric visibility is +needed, but be aware it produces significantly higher metrics volume.

+

"SRE"

MetricsSetSRE collects the metrics defined in the sre-metric-set ConfigMap, +which includes the Telemetry set plus additional metrics needed for SRE +monitoring dashboards and alerts. Use this for clusters that require +SRE observability.

+

"Telemetry"

MetricsSetTelemetry collects only the minimal set of metrics required for +OpenShift Telemetry. Use this to minimize metrics volume while still +satisfying cluster telemetry requirements.

+
+###MonitoringSpec { #hypershift.openshift.io/v1beta1.MonitoringSpec } +

+(Appears on: +HostedClusterSpec, +HostedControlPlaneSpec) +

+

+

MonitoringSpec configures monitoring for the hosted cluster. +At least one field must be specified when this struct is present.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+metricsForwarding,omitzero
+ + +MetricsForwardingSpec + + +
+(Optional) +

metricsForwarding configures forwarding of control plane metrics into +the hosted cluster’s monitoring stack. +When omitted, metrics forwarding behavior is determined by the +hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. +If neither is set, metrics forwarding is disabled.

+
+metricsSet
+ + +MetricsSet + + +
+(Optional) +

metricsSet specifies which set of metrics to collect and forward. +This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. +When not specified, the global METRICS_SET value is used, which defaults to “Telemetry”.

+

“Telemetry” collects only the minimal set of metrics required for OpenShift Telemetry. +“SRE” collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, +needed for SRE dashboards and alerts. +“All” collects all metrics from control plane components without filtering, +which produces significantly higher metrics volume.

+
###MultiQueueSetting { #hypershift.openshift.io/v1beta1.MultiQueueSetting }

(Appears on: diff --git a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go index f7c2deac532f..355df6fb8c15 100644 --- a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go +++ b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go @@ -2009,6 +2009,11 @@ func (r *HostedClusterReconciler) reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{}, fmt.Errorf("failed to parse SecurityContext UID: %w", err) } } + + metricsSet := r.MetricsSet + if hcluster.Spec.Monitoring.MetricsSet != "" { + metricsSet = metrics.MetricsSet(hcluster.Spec.Monitoring.MetricsSet) + } cpContext := controlplanecomponent.ControlPlaneContext{ Context: ctx, Client: r.Client, @@ -2017,7 +2022,7 @@ func (r *HostedClusterReconciler) reconcile(ctx context.Context, req ctrl.Reques SetDefaultSecurityContext: r.SetDefaultSecurityContext, DefaultSecurityContextUID: securityContextUID, EnableCIDebugOutput: r.EnableCIDebugOutput, - MetricsSet: r.MetricsSet, + MetricsSet: metricsSet, ReleaseImageProvider: imageProvider, OmitOwnerReference: true, } @@ -2554,6 +2559,16 @@ func reconcileHostedControlPlane(hcp *hyperv1.HostedControlPlane, hcluster *hype hcp.Spec.OperatorConfiguration = nil } + hcp.Spec.Monitoring = hcluster.Spec.Monitoring + // Backward compat: if the deprecated annotation is present and the spec mode is not explicitly set, + // enable metrics forwarding on the HCP so that downstream consumers (CPO, HCCO) use the spec field. + // An explicit Disabled mode takes precedence over the annotation. + if hcp.Spec.Monitoring.MetricsForwarding.Mode == "" { + if _, hasAnnotation := hcluster.Annotations[hyperv1.EnableMetricsForwarding]; hasAnnotation { + hcp.Spec.Monitoring.MetricsForwarding.Mode = hyperv1.MetricsForwardingModeForward + } + } + return nil } @@ -5163,7 +5178,11 @@ func (r *HostedClusterReconciler) reconcileMonitoringDashboard(ctx context.Conte // and ensures that it is synced to the hosted control plane func (r *HostedClusterReconciler) reconcileSREMetricsConfig(ctx context.Context, createOrUpdate upsert.CreateOrUpdateFN, hcp *hyperv1.HostedControlPlane) error { log := ctrl.LoggerFrom(ctx) - if r.MetricsSet != metrics.MetricsSetSRE { + effectiveMetricsSet := r.MetricsSet + if hcp.Spec.Monitoring.MetricsSet != "" { + effectiveMetricsSet = metrics.MetricsSet(hcp.Spec.Monitoring.MetricsSet) + } + if effectiveMetricsSet != metrics.MetricsSetSRE { return nil } log.Info("Reconciling SRE metrics configuration") diff --git a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go index 4554f0cbc5b5..cd15d3c477d7 100644 --- a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go +++ b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go @@ -39,6 +39,7 @@ import ( "github.com/openshift/hypershift/support/config" controlplanecomponent "github.com/openshift/hypershift/support/controlplane-component" "github.com/openshift/hypershift/support/k8sutil" + "github.com/openshift/hypershift/support/metrics" "github.com/openshift/hypershift/support/releaseinfo" "github.com/openshift/hypershift/support/releaseinfo/registryclient" "github.com/openshift/hypershift/support/releaseinfo/testutils" @@ -864,6 +865,105 @@ func TestReconcileHostedControlPlaneConfiguration(t *testing.T) { } } +func TestReconcileHostedControlPlaneMonitoring(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + monitoring hyperv1.MonitoringSpec + annotations map[string]string + expectedMonitoring hyperv1.MonitoringSpec + }{ + { + name: "When monitoring spec is set with mode Enabled, it should be copied to HCP", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + MetricsSet: hyperv1.MetricsSetSRE, + }, + expectedMonitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + MetricsSet: hyperv1.MetricsSetSRE, + }, + }, + { + name: "When monitoring spec is not set and annotation is present, it should enable forwarding on HCP", + annotations: map[string]string{ + hyperv1.EnableMetricsForwarding: "true", + }, + expectedMonitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + }, + }, + { + name: "When neither spec nor annotation is set, it should leave monitoring empty", + expectedMonitoring: hyperv1.MonitoringSpec{}, + }, + { + name: "When mode is Disabled and annotation is present, it should not override Disabled", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeNone, + }, + }, + annotations: map[string]string{ + hyperv1.EnableMetricsForwarding: "true", + }, + expectedMonitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeNone, + }, + }, + }, + { + name: "When mode is Enabled and annotation is absent, it should keep Enabled", + monitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + }, + expectedMonitoring: hyperv1.MonitoringSpec{ + MetricsForwarding: hyperv1.MetricsForwardingSpec{ + Mode: hyperv1.MetricsForwardingModeForward, + }, + }, + }, + { + name: "When metricsSet is set without forwarding mode, it should be copied", + monitoring: hyperv1.MonitoringSpec{ + MetricsSet: hyperv1.MetricsSetAll, + }, + expectedMonitoring: hyperv1.MonitoringSpec{ + MetricsSet: hyperv1.MetricsSetAll, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + g := NewGomegaWithT(t) + + hostedCluster := &hyperv1.HostedCluster{ + ObjectMeta: metav1.ObjectMeta{ + Annotations: test.annotations, + }, + } + hostedCluster.Spec.Monitoring = test.monitoring + hostedControlPlane := &hyperv1.HostedControlPlane{} + + err := reconcileHostedControlPlane(hostedControlPlane, hostedCluster, true, true, func() (map[string]string, error) { return nil, nil }) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(hostedControlPlane.Spec.Monitoring).To(Equal(test.expectedMonitoring)) + }) + } +} + func TestReconcileHostedControlPlaneAnnotations(t *testing.T) { t.Parallel() type testCase struct { @@ -7657,3 +7757,92 @@ func TestReconcileETCDMemberRecovery(t *testing.T) { g.Expect(err.Error()).To(ContainSubstring("failed to get etcd statefulset")) }) } + +func TestReconcileSREMetricsConfig_EffectiveMetricsSet(t *testing.T) { + operatorNS := "hypershift" + hcpNS := "clusters-test" + + sreConfigCM := &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{ + Name: "sre-metric-set", + Namespace: operatorNS, + }, + Data: map[string]string{ + "config": "{}", + }, + } + + baseHCP := &hyperv1.HostedControlPlane{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test", + Namespace: hcpNS, + }, + } + + noopCreateOrUpdate := func(ctx context.Context, c crclient.Client, obj crclient.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error) { + return controllerutil.OperationResultNone, nil + } + + tests := []struct { + name string + operatorMetricSet metrics.MetricsSet + hcpMetricsSet hyperv1.MetricsSet + expectSREReconcile bool + }{ + { + name: "When hcp.Spec.Monitoring.MetricsSet is SRE it should override operator default Telemetry", + operatorMetricSet: metrics.MetricsSetTelemetry, + hcpMetricsSet: hyperv1.MetricsSetSRE, + expectSREReconcile: true, + }, + { + name: "When hcp.Spec.Monitoring.MetricsSet is empty it should use operator default SRE", + operatorMetricSet: metrics.MetricsSetSRE, + hcpMetricsSet: "", + expectSREReconcile: true, + }, + { + name: "When hcp.Spec.Monitoring.MetricsSet is empty it should use operator default Telemetry and skip SRE", + operatorMetricSet: metrics.MetricsSetTelemetry, + hcpMetricsSet: "", + expectSREReconcile: false, + }, + { + name: "When hcp.Spec.Monitoring.MetricsSet is Telemetry it should override operator SRE and skip SRE reconcile", + operatorMetricSet: metrics.MetricsSetSRE, + hcpMetricsSet: hyperv1.MetricsSetTelemetry, + expectSREReconcile: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + g := NewWithT(t) + + hcp := baseHCP.DeepCopy() + hcp.Spec.Monitoring.MetricsSet = tt.hcpMetricsSet + + objs := []crclient.Object{} + if tt.expectSREReconcile { + objs = append(objs, sreConfigCM.DeepCopy()) + } + cli := fake.NewClientBuilder().WithScheme(api.Scheme).WithObjects(objs...).Build() + + r := &HostedClusterReconciler{ + Client: cli, + MetricsSet: tt.operatorMetricSet, + OperatorNamespace: operatorNS, + } + + ctx := ctrl.LoggerInto(t.Context(), zap.New(zap.UseDevMode(true), zap.Level(zapcore.InfoLevel))) + err := r.reconcileSREMetricsConfig(ctx, noopCreateOrUpdate, hcp) + g.Expect(err).ToNot(HaveOccurred()) + + if tt.expectSREReconcile { + g.Expect(r.SREConfigHash).ToNot(BeEmpty(), "SRE config hash should be set when SRE metrics are active") + } else { + g.Expect(r.SREConfigHash).To(BeEmpty(), "SRE config hash should not be set when SRE metrics are not active") + } + }) + } +} diff --git a/test/e2e/util/util_metrics_proxy.go b/test/e2e/util/util_metrics_proxy.go index df0ed701c875..5bc051c3969f 100644 --- a/test/e2e/util/util_metrics_proxy.go +++ b/test/e2e/util/util_metrics_proxy.go @@ -46,15 +46,12 @@ func EnsureMetricsForwarderWorking(t *testing.T, ctx context.Context, mgtClient g := NewWithT(t) hcpNamespace := manifests.HostedControlPlaneNamespace(hostedCluster.Namespace, hostedCluster.Name) - // 1. Enable metrics forwarding by adding the annotation. + // 1. Enable metrics forwarding via spec. t.Log("Enabling metrics forwarding on HostedCluster") err := UpdateObject(t, ctx, mgtClient, hostedCluster, func(obj *hyperv1.HostedCluster) { - if obj.Annotations == nil { - obj.Annotations = make(map[string]string) - } - obj.Annotations[hyperv1.EnableMetricsForwarding] = "true" + obj.Spec.Monitoring.MetricsForwarding.Mode = hyperv1.MetricsForwardingModeForward }) - g.Expect(err).NotTo(HaveOccurred(), "failed to patch HostedCluster with EnableMetricsForwarding annotation") + g.Expect(err).NotTo(HaveOccurred(), "failed to enable metrics forwarding on HostedCluster") // 2. Wait for management-side deployments. t.Log("Waiting for endpoint-resolver deployment") diff --git a/test/e2e/v2/tests/hosted_cluster_metrics_test.go b/test/e2e/v2/tests/hosted_cluster_metrics_test.go index 82eff03f0409..ddd6058864ca 100644 --- a/test/e2e/v2/tests/hosted_cluster_metrics_test.go +++ b/test/e2e/v2/tests/hosted_cluster_metrics_test.go @@ -143,8 +143,8 @@ func EnsureMetricsForwarderWorkingTest(getTestCtx internal.TestContextGetter) { Skip("metrics forwarder requires version >= 4.22") } - if hostedCluster.Annotations[hyperv1.EnableMetricsForwarding] != "true" { - Skip("metrics forwarding annotation not set on hosted cluster; skipping verification test") + if hostedCluster.Spec.Monitoring.MetricsForwarding.Mode != hyperv1.MetricsForwardingModeForward { + Skip("metrics forwarding not enabled on hosted cluster; skipping verification test") } By("Waiting for management-side metrics deployments") diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hosted_controlplane.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hosted_controlplane.go index 8486514f0a18..5e64ed314e6e 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hosted_controlplane.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hosted_controlplane.go @@ -187,6 +187,13 @@ type HostedControlPlaneSpec struct { // +optional OperatorConfiguration *OperatorConfiguration `json:"operatorConfiguration,omitempty"` + // monitoring configures monitoring for the hosted cluster, including + // forwarding of control plane metrics to the hosted cluster's monitoring stack. + // When omitted, metrics forwarding is not configured and will be inactive. + // + // +optional + Monitoring MonitoringSpec `json:"monitoring,omitzero"` + // imageContentSources lists sources/repositories for the release-image content. // +optional // +kubebuilder:validation:MaxItems=255 diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go index 74b50f24ad38..34e0e1b96485 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go @@ -273,6 +273,8 @@ const ( // EnableMetricsForwarding enables metrics forwarding from the management cluster to hosted clusters. // When present, components like the endpoint-resolver and metrics-proxy will be deployed. + // Deprecated: Use spec.monitoring.metricsForwarding instead. This annotation is preserved + // for backward compatibility and will be honored when spec.monitoring is not set. EnableMetricsForwarding = "hypershift.openshift.io/enable-metrics-forwarding" // JSONPatchAnnotation allow modifying the kubevirt VM template using jsonpatch @@ -833,6 +835,15 @@ type HostedClusterSpec struct { // +kubebuilder:default={} // +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Capabilities is immutable. Changes might result in unpredictable and disruptive behavior." Capabilities *Capabilities `json:"capabilities,omitempty"` + + // monitoring configures monitoring for the hosted cluster, including + // forwarding of control plane metrics to the hosted cluster's monitoring stack. + // When omitted, metrics forwarding behavior is determined by the + // hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + // If neither is set, metrics forwarding is disabled. + // + // +optional + Monitoring MonitoringSpec `json:"monitoring,omitzero"` } // OLMCatalogPlacement is an enum specifying the placement of OLM catalog components. @@ -869,6 +880,97 @@ func (olm *OLMCatalogPlacement) Type() string { return "OLMCatalogPlacement" } +// MetricsForwardingMode controls whether metrics forwarding is active for a hosted cluster. +// +// +kubebuilder:validation:Enum=Forward;None +type MetricsForwardingMode string + +const ( + // MetricsForwardingModeForward indicates metrics forwarding is active. + MetricsForwardingModeForward MetricsForwardingMode = "Forward" + + // MetricsForwardingModeNone indicates metrics forwarding is inactive. + MetricsForwardingModeNone MetricsForwardingMode = "None" +) + +// MetricsSet specifies the set of metrics to collect and forward from hosted clusters. +// +// +kubebuilder:validation:Enum=Telemetry;SRE;All +type MetricsSet string + +const ( + // MetricsSetTelemetry collects only the minimal set of metrics required for + // OpenShift Telemetry. Use this to minimize metrics volume while still + // satisfying cluster telemetry requirements. + MetricsSetTelemetry MetricsSet = "Telemetry" + + // MetricsSetSRE collects the metrics defined in the sre-metric-set ConfigMap, + // which includes the Telemetry set plus additional metrics needed for SRE + // monitoring dashboards and alerts. Use this for clusters that require + // SRE observability. + MetricsSetSRE MetricsSet = "SRE" + + // MetricsSetAll collects all metrics from control plane components without + // any filtering. Use this for debugging or when full metric visibility is + // needed, but be aware it produces significantly higher metrics volume. + MetricsSetAll MetricsSet = "All" +) + +// MonitoringSpec configures monitoring for the hosted cluster. +// At least one field must be specified when this struct is present. +// +// +kubebuilder:validation:MinProperties=1 +type MonitoringSpec struct { + // metricsForwarding configures forwarding of control plane metrics into + // the hosted cluster's monitoring stack. + // When omitted, metrics forwarding behavior is determined by the + // hypershift.openshift.io/enable-metrics-forwarding annotation for backward compatibility. + // If neither is set, metrics forwarding is disabled. + // + // +optional + MetricsForwarding MetricsForwardingSpec `json:"metricsForwarding,omitzero"` + + // metricsSet specifies which set of metrics to collect and forward. + // This overrides the global METRICS_SET environment variable configured on the HyperShift Operator. + // When not specified, the global METRICS_SET value is used, which defaults to "Telemetry". + // + // "Telemetry" collects only the minimal set of metrics required for OpenShift Telemetry. + // "SRE" collects the Telemetry set plus additional metrics defined in the sre-metric-set ConfigMap, + // needed for SRE dashboards and alerts. + // "All" collects all metrics from control plane components without filtering, + // which produces significantly higher metrics volume. + // + // +optional + MetricsSet MetricsSet `json:"metricsSet,omitempty"` +} + +// MetricsForwardingSpec configures metrics forwarding for the hosted cluster. +type MetricsForwardingSpec struct { + // mode controls whether metrics forwarding is active for this hosted cluster. + // When set to "Forward", metrics-proxy and endpoint-resolver are deployed in the + // control plane, and a metrics-forwarder is deployed in the hosted cluster. + // When set to "None", metrics forwarding is inactive. + // + // +required + Mode MetricsForwardingMode `json:"mode,omitempty"` + + // metricsSet specifies which set of metrics to forward to the hosted + // cluster's monitoring stack. This controls only the metrics-proxy forwarding + // path and does not affect management-cluster-side ServiceMonitor/PodMonitor + // relabel configurations. + // When not specified, the value from monitoring.metricsSet is used, which itself + // falls back to the global METRICS_SET environment variable (default "Telemetry"). + // + // "Telemetry" forwards only the minimal set of metrics required for OpenShift Telemetry. + // "SRE" forwards the Telemetry set plus additional metrics defined in the sre-metric-set + // ConfigMap, needed for SRE dashboards and alerts. + // "All" forwards all metrics from control plane components without filtering, + // which produces significantly higher metrics volume. + // + // +optional + MetricsSet MetricsSet `json:"metricsSet,omitempty"` +} + // ImageContentSource specifies image mirrors that can be used by cluster nodes // to pull content. For cluster workloads, if a container image registry host of // the pullspec matches Source then one of the Mirrors are substituted as hosts diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go index 454f86378499..5a2726d43b69 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go @@ -2406,6 +2406,7 @@ func (in *HostedClusterSpec) DeepCopyInto(out *HostedClusterSpec) { *out = new(Capabilities) (*in).DeepCopyInto(*out) } + out.Monitoring = in.Monitoring } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostedClusterSpec. @@ -2578,6 +2579,7 @@ func (in *HostedControlPlaneSpec) DeepCopyInto(out *HostedControlPlaneSpec) { *out = new(OperatorConfiguration) (*in).DeepCopyInto(*out) } + out.Monitoring = in.Monitoring if in.ImageContentSources != nil { in, out := &in.ImageContentSources, &out.ImageContentSources *out = make([]ImageContentSource, len(*in)) @@ -3428,6 +3430,37 @@ func (in *ManagedIdentity) DeepCopy() *ManagedIdentity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricsForwardingSpec) DeepCopyInto(out *MetricsForwardingSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsForwardingSpec. +func (in *MetricsForwardingSpec) DeepCopy() *MetricsForwardingSpec { + if in == nil { + return nil + } + out := new(MetricsForwardingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitoringSpec) DeepCopyInto(out *MonitoringSpec) { + *out = *in + out.MetricsForwarding = in.MetricsForwarding +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitoringSpec. +func (in *MonitoringSpec) DeepCopy() *MonitoringSpec { + if in == nil { + return nil + } + out := new(MonitoringSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkFilter) DeepCopyInto(out *NetworkFilter) { *out = *in