From ef85a73cc4c0bbd9c3e2d4e512d27edfadde94d0 Mon Sep 17 00:00:00 2001 From: Tom Coufal <7453394+tumido@users.noreply.github.com> Date: Wed, 7 Sep 2022 16:04:46 +0200 Subject: [PATCH] Fake metrics endpoint to make ODF happy (#2391) * Fake metrics endpoint to make ODF happy While the "monitoring-endpoint" configuration in OCS 4.8 was optional, it appears to be required in 4.10, and ODF refuses to deploy if it can't reach the endpoint. This commit provides a fake metrics endpoint to make the ODF operator happy. * feat: Adopt NESE manifests to Operate First repo layout Signed-off-by: Tomas Coufal Signed-off-by: Tomas Coufal Co-authored-by: Lars Kellogg-Stedman --- .../cluster-management/kustomization.yaml | 1 + .../odf-fake-metrics-exporter.yaml | 20 +++++++++++++++++++ fake-metrics-server/base/deployment.yaml | 13 ++++++++++++ fake-metrics-server/base/kustomization.yaml | 7 +++++++ fake-metrics-server/base/service.yaml | 8 ++++++++ .../openshift-storage/deploy_patch.yaml | 17 ++++++++++++++++ .../openshift-storage/kustomization.yaml | 11 ++++++++++ .../overlays/openshift-storage/metrics.json | 16 +++++++++++++++ 8 files changed, 93 insertions(+) create mode 100644 argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/odf-fake-metrics-exporter.yaml create mode 100644 fake-metrics-server/base/deployment.yaml create mode 100644 fake-metrics-server/base/kustomization.yaml create mode 100644 fake-metrics-server/base/service.yaml create mode 100644 fake-metrics-server/overlays/openshift-storage/deploy_patch.yaml create mode 100644 fake-metrics-server/overlays/openshift-storage/kustomization.yaml create mode 100644 fake-metrics-server/overlays/openshift-storage/metrics.json diff --git a/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/kustomization.yaml b/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/kustomization.yaml index 7a8bd7d71..36981e159 100644 --- a/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/kustomization.yaml +++ b/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/kustomization.yaml @@ -11,3 +11,4 @@ resources: - external-secrets.yaml - keycloak.yaml - kubevirt-hyperconverged.yaml + - odf-fake-metrics-exporter.yaml diff --git a/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/odf-fake-metrics-exporter.yaml b/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/odf-fake-metrics-exporter.yaml new file mode 100644 index 000000000..cd30b3247 --- /dev/null +++ b/argocd/overlays/moc-infra/applications/envs/moc/infra/cluster-management/odf-fake-metrics-exporter.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: odf-fake-metrics-exporter +spec: + destination: + name: moc-infra + namespace: openshift-storage + project: cluster-management + source: + path: fake-metrics-server/overlays/openshift-storage + repoURL: https://github.com/operate-first/apps.git + targetRevision: HEAD + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - Validate=false + - ApplyOutOfSyncOnly=true diff --git a/fake-metrics-server/base/deployment.yaml b/fake-metrics-server/base/deployment.yaml new file mode 100644 index 000000000..604f5dd12 --- /dev/null +++ b/fake-metrics-server/base/deployment.yaml @@ -0,0 +1,13 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fake-metrics-exporter +spec: + template: + spec: + containers: + - name: fake-metrics-exporter + image: quay.io/larsks/fake-metrics-exporter:v0.1.0 + ports: + - name: metrics + containerPort: 9283 diff --git a/fake-metrics-server/base/kustomization.yaml b/fake-metrics-server/base/kustomization.yaml new file mode 100644 index 000000000..e8e9fae46 --- /dev/null +++ b/fake-metrics-server/base/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +commonLabels: + app.kubernetes.io/name: fake-metrics-server +resources: +- deployment.yaml +- service.yaml diff --git a/fake-metrics-server/base/service.yaml b/fake-metrics-server/base/service.yaml new file mode 100644 index 000000000..a9e645857 --- /dev/null +++ b/fake-metrics-server/base/service.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Service +metadata: + name: fake-metrics-exporter +spec: + ports: + - port: 9283 + targetPort: metrics diff --git a/fake-metrics-server/overlays/openshift-storage/deploy_patch.yaml b/fake-metrics-server/overlays/openshift-storage/deploy_patch.yaml new file mode 100644 index 000000000..24718b85f --- /dev/null +++ b/fake-metrics-server/overlays/openshift-storage/deploy_patch.yaml @@ -0,0 +1,17 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fake-metrics-exporter +spec: + template: + spec: + volumes: + - name: fake-metrics + configMap: + name: fake-metrics + containers: + - name: fake-metrics-exporter + volumeMounts: + - name: fake-metrics + mountPath: /metrics.json + subPath: metrics.json diff --git a/fake-metrics-server/overlays/openshift-storage/kustomization.yaml b/fake-metrics-server/overlays/openshift-storage/kustomization.yaml new file mode 100644 index 000000000..ae1acd9ea --- /dev/null +++ b/fake-metrics-server/overlays/openshift-storage/kustomization.yaml @@ -0,0 +1,11 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: openshift-storage +resources: + - ../../base/ +patches: + - path: deploy_patch.yaml +configMapGenerator: + - name: fake-metrics + files: + - metrics.json diff --git a/fake-metrics-server/overlays/openshift-storage/metrics.json b/fake-metrics-server/overlays/openshift-storage/metrics.json new file mode 100644 index 000000000..5ef9270e4 --- /dev/null +++ b/fake-metrics-server/overlays/openshift-storage/metrics.json @@ -0,0 +1,16 @@ +{ + "ceph_health_status": 0.0, + "ceph_osd_flag_noup": 0.0, + "ceph_osd_flag_nodown": 0.0, + "ceph_osd_flag_noout": 0.0, + "ceph_osd_flag_noin": 0.0, + "ceph_osd_flag_nobackfill": 0.0, + "ceph_osd_flag_norebalance": 0.0, + "ceph_osd_flag_norecover": 0.0, + "ceph_osd_flag_noscrub": 0.0, + "ceph_osd_flag_nodeep_scrub": 0.0, + "ceph_num_objects_degraded": 0.0, + "ceph_num_objects_misplaced": 0.0, + "ceph_num_objects_unfound": 0.0, + "ceph_healthcheck_slow_ops": 0.0 +}