Skip to content

Add MDM standard connectors

There are three default connectors for CODECO available. You can find it in the MDM connector

If I understand the post_install.sh from the branch rht-integration correctly, is it simple to add this code of lines.

  • Add after the line 30
cd ..
cd mdm-connectors
sed -i "s/<namespace>/$MDM_NAMESPACE/g" ./connectors/k8s/src/main/helm/values.yaml
sed -i "s/<clustername>/$MDM_CONTEXT/g" ./connectors/k8s/src/main/helm/values.yaml
sed -i "s/<namespace>/$MDM_NAMESPACE/g" ./connectors/kubescape/src/main/helm/values.yaml
sed -i "s/<clustername>/$MDM_CONTEXT/g" ./connectors/kubescape/src/main/helm/values.yaml
sed -i "s/<namespace>/$MDM_NAMESPACE/g" ./connectors/prometheus/src/main/helm/values.yaml
sed -i "s/<clustername>/$MDM_CONTEXT/g" ./connectors/prometheus/src/main/helm/values.yaml
# Prometheus config set the Prometheus url to $PROMETHEUS_URL
# Prometheus config set the Prometheus port to $PROMETHEUS_PORT
sed -i "s|http://prometheus-service.monitoring.svc.cluster.local|$PROMETHEUS_URL|g" ./connectors/prometheus/src/main/helm/values.yaml
sed -i "s/9090/$PROMETHEUS_PORT/g" ./connectors/prometheus/src/main/helm/values.yaml
helm --kube-context=$MDM_CONTEXT -n $MDM_NAMESPACE install k8s-connector ./connectors/k8s/src/main/helm -f ./connectors/k8s/src/main/helm/values.yaml 
helm --kube-context=$MDM_CONTEXT -n $MDM_NAMESPACE install kubescape-connector ./connectors/kubescape/src/main/helm -f ./connectors/kubescape/src/main/helm/values.yaml 
helm --kube-context=$MDM_CONTEXT -n $MDM_NAMESPACE install freshness-connector ./connectors/prometheus/src/main/helm -f ./connectors/prometheus/src/main/helm/values.yaml 

Two environment variables are missing. The PROMETHEUS_URL and $PROMETHEUS_PORT must be set and exported for the prometheus connector.

As the default metric CODECO_freshness will be used, so every service can use it to get the freshness and it will be correct in the MDM reflected.

  • Configure the service to advise Prometheus to use it.
...
spec:
  replicas: 1
  selector:
    matchLabels:
      app: <your service app>
  template:
    metadata:
      labels:
        app: <your service app>
      annotations:
        prometheus.io/port: <port>
        prometheus.io/scrape: "true"
        prometheus.io/path: <metric path>

FYI @lga

Edited by Peter Urbanetz