Skip to content

Commit d513317

Browse files
Merge pull request #406 from abraham2512/acm-route-policy-rmf
telco-ran: OCPBUGS-63008: Improve RAN monitoring footprint CR to get alertmanager url from MCL annotation
2 parents d729c01 + c786902 commit d513317

File tree

7 files changed

+99
-5
lines changed

7 files changed

+99
-5
lines changed

telco-core/configuration/reference-crs/optional/other/monitoring-config-cm.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# optional
22
# count: 1
33
---
4+
# Core Observability configuration
5+
# As a prerequisite for merging Core Observability configuration with openshift-monitoring, apply the observabilityRoutePolicy on the HUB from the telco-hub required reference-crs. This is needed to copy the alert-manager URL from the hub side open-cluster-management-observability namespace and make it available in the openshift-monitoring configmap.
46
apiVersion: v1
57
kind: ConfigMap
68
metadata:
@@ -27,7 +29,7 @@ data:
2729
name: observability-alertmanager-accessor
2830
scheme: https
2931
staticConfigs:
30-
- {{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{ (regexFind "alertmanager-endpoint(.*)" ((fromSecret "open-cluster-management-addon-observability" "hub-info-secret" "hub-info.yaml") | base64dec)) | replace "alertmanager-endpoint: https://" "" }}{{ end }}
32+
- {{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{hub index (lookup "cluster.open-cluster-management.io/v1" "ManagedCluster" "" .ManagedClusterName).metadata.annotations "acm-alertmanager-route" hub}}{{ end }}
3133
tlsConfig:
3234
ca:
3335
key: service-ca.crt

telco-hub/configuration/reference-crs-kube-compare/compare_ignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ required/acm/acmPerfSearch.yaml
3636
# compare does not include the full policy content due to policy templating.
3737
required/acm/thanosSecretPolicy.yaml
3838
required/gitops/addPluginsPolicy.yaml
39+
# observabilityRoutePolicy is ignored as reference compare does
40+
# not include the full policy content due to policy templating.
41+
required/acm/observabilityRoutePolicy.yaml
42+
3943
required/gitops/extra-manifests-policy.yaml
4044
# ArgoCD files
4145
kustomization.yaml
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
apiVersion: policy.open-cluster-management.io/v1
3+
kind: Policy
4+
metadata:
5+
annotations:
6+
policy.open-cluster-management.io/categories: CM Configuration Management
7+
policy.open-cluster-management.io/controls: CM-2 Baseline Configuration
8+
policy.open-cluster-management.io/standards: NIST SP 800-53
9+
ran.openshift.io/ztp-deploy-wave: "1"
10+
name: obs-route-policy
11+
namespace: open-cluster-management-observability
12+
spec:
13+
remediationAction: enforce
14+
disabled: false
15+
policy-templates:
16+
- objectDefinition:
17+
apiVersion: policy.open-cluster-management.io/v1
18+
kind: ConfigurationPolicy
19+
metadata:
20+
name: obs-route-policy
21+
spec:
22+
remediationAction: enforce
23+
severity: low
24+
namespaceSelector:
25+
exclude:
26+
- kube-*
27+
include:
28+
- '*'
29+
object-templates-raw: |
30+
{{- range (lookup "cluster.open-cluster-management.io/v1" "ManagedCluster" "" "").items }}
31+
- metadataComplianceType: musthave
32+
objectDefinition:
33+
apiVersion: cluster.open-cluster-management.io/v1
34+
kind: ManagedCluster
35+
metadata:
36+
name: {{ .metadata.name }}
37+
annotations:
38+
acm-alertmanager-route: '{{ (lookup "route.openshift.io/v1" "Route" "open-cluster-management-observability" "alertmanager").spec.host }}'
39+
{{- end }}
40+
---
41+
apiVersion: cluster.open-cluster-management.io/v1beta1
42+
kind: Placement
43+
metadata:
44+
name: obs-route-policy-placement
45+
namespace: open-cluster-management-observability
46+
spec:
47+
predicates:
48+
- requiredClusterSelector:
49+
labelSelector:
50+
matchExpressions:
51+
- key: local-cluster
52+
operator: In
53+
values:
54+
- "true"
55+
tolerations:
56+
- key: cluster.open-cluster-management.io/unavailable
57+
operator: Exists
58+
- key: cluster.open-cluster-management.io/unreachable
59+
operator: Exists
60+
---
61+
apiVersion: policy.open-cluster-management.io/v1
62+
kind: PlacementBinding
63+
metadata:
64+
name: obs-route-policy-placementbinding
65+
namespace: open-cluster-management-observability
66+
placementRef:
67+
name: obs-route-policy-placement
68+
kind: Placement
69+
apiGroup: cluster.open-cluster-management.io
70+
subjects:
71+
- name: obs-route-policy
72+
kind: Policy
73+
apiGroup: policy.open-cluster-management.io
74+
---
75+
apiVersion: cluster.open-cluster-management.io/v1beta2
76+
kind: ManagedClusterSetBinding
77+
metadata:
78+
name: default
79+
namespace: open-cluster-management-observability
80+
spec:
81+
clusterSet: default

telco-hub/configuration/reference-crs/required/acm/readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
Thanos secret.
2727
12. Create the `observabilityMCO.yaml`.
2828
13. When all the installation is done. Apply the `acmPerfSearch.yaml` .This will configure Search CR called `search-v2-operator` considering different performance and scale optimizations.
29-
14. When ACM Observability is configured on a managed cluster through the Core or RAN profile, the default ACM Observability configuration must be merged with the RAN monitoring tuning [ReduceMonitoringFootprint.yaml](../../../../../telco-ran/configuration/source-crs/ReduceMonitoringFootprint.yaml) or Core monitoring config [monitoring-config-cm.yaml](../../../../../telco-core/configuration/reference-crs/optional/other/monitoring-config-cm.yaml) respectively. To ensure that these changes persist, ACM has to stop managing the cluster-monitoring-config ConfigMap, which is set in this annotation [here](../../../../../telco-hub/configuration/reference-crs/required/acm/observabilityMCO.yaml#L13).
29+
14. When ACM Observability is configured on a managed cluster through the Core or RAN profile, the default ACM Observability configuration must be merged with the RAN monitoring tuning [ReduceMonitoringFootprint.yaml](../../../../../telco-ran/configuration/source-crs/ReduceMonitoringFootprint.yaml) or Core monitoring config [monitoring-config-cm.yaml](../../../../../telco-core/configuration/reference-crs/optional/other/monitoring-config-cm.yaml) respectively.
30+
* To ensure that these changes persist, ACM has to stop managing the cluster-monitoring-config ConfigMap, which is achieved through this annotation [here](../../../../../telco-hub/configuration/reference-crs/required/acm/observabilityMCO.yaml#L13).
31+
* When mco-alerting is disabled, the [obs-route-policy](observabilityRoutePolicy.yaml) should be used for propagating the alertmanager URL from the ACM observability route to all managed clusters through the `acm-alertmanager-route` annotation.
3032

3133
Back to [Hub Cluster Setup](../../../../README.md).
32-

telco-ran/configuration/kube-compare-reference/cluster-tuning/monitoring-configuration/ReduceMonitoringFootprint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
# RAN Observability configuration
3+
# As a prerequisite for merging RAN Observability configuration with openshift-monitoring, apply the observabilityRoutePolicy on the HUB from the telco-hub required reference-crs. This is needed to copy the alert-manager URL from the hub side open-cluster-management-observability namespace and make it available in the openshift-monitoring configmap.
14
apiVersion: v1
25
kind: ConfigMap
36
metadata:

telco-ran/configuration/kube-compare-reference/hack/default_value.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ cluster_tuning_monitoring_configuration_ReduceMonitoringFootprint:
331331
- metadata:
332332
name: cluster-monitoring-config
333333
captureGroup_defaults:
334-
alertmanager_endpoint: '{{ `{{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{ (regexFind "alertmanager-endpoint(.*)" ((fromSecret "open-cluster-management-addon-observability" "hub-info-secret" "hub-info.yaml") | base64dec)) | replace "alertmanager-endpoint: https://" "" }}{{ end }}` }}'
334+
alertmanager_endpoint: '{{ `{{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{hub index (lookup "cluster.open-cluster-management.io/v1" "ManagedCluster" "" .ManagedClusterName).metadata.annotations "acm-alertmanager-route" hub}}{{ end }}` }}'
335335
managed_cluster: '{{ `{{ fromClusterClaim "id.openshift.io" }}` }}'
336336
lca_LcaSubscription:
337337
- spec:

telco-ran/configuration/source-crs/cluster-tuning/monitoring-configuration/ReduceMonitoringFootprint.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
# RAN Observability configuration
3+
# As a prerequisite for merging RAN Observability configuration with openshift-monitoring, apply the observabilityRoutePolicy on the HUB from the telco-hub required reference-crs. This is needed to copy the alert-manager URL from the hub side open-cluster-management-observability namespace and make it available in the openshift-monitoring configmap.
14
apiVersion: v1
25
kind: ConfigMap
36
metadata:
@@ -30,7 +33,7 @@ data:
3033
name: observability-alertmanager-accessor
3134
scheme: https
3235
staticConfigs:
33-
- {{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{ (regexFind "alertmanager-endpoint(.*)" ((fromSecret "open-cluster-management-addon-observability" "hub-info-secret" "hub-info.yaml") | base64dec)) | replace "alertmanager-endpoint: https://" "" }}{{ end }}
36+
- {{ if (lookup "v1" "Namespace" "" "open-cluster-management-addon-observability") }}{{hub index (lookup "cluster.open-cluster-management.io/v1" "ManagedCluster" "" .ManagedClusterName).metadata.annotations "acm-alertmanager-route" hub}}{{ end }}
3437
tlsConfig:
3538
ca:
3639
key: service-ca.crt

0 commit comments

Comments
 (0)