prometheus-operator / kube-prometheus

Use Prometheus to monitor Kubernetes and applications running on Kubernetes
https://prometheus-operator.dev/
Apache License 2.0
6.76k stars 1.93k forks source link

eks-cni-example is not generating manifests #1459

Open oussama-mechlaoui opened 3 years ago

oussama-mechlaoui commented 3 years ago

What happened?

I am not able to generate eks platform manifeste using eks-cni-example.jsonnet. I have used the kube-prometheus stack version release-0.9

Did you expect to see some different?

How to reproduce it (as minimally and precisely as possible):

jsonnet.json:

{
  "version": 1,
  "dependencies": [
    {
      "source": {
        "git": {
          "remote": "https://github.com/prometheus-operator/kube-prometheus.git",
          "subdir": "jsonnet/kube-prometheus"
        }
      },
      "version": "release-0.9"
    }
  ],
  "legacyImports": true
}

cni.jsonnet (main file):

local kp = (import 'kube-prometheus/main.libsonnet') + {
  values+:: {
    common+: {
      namespace: 'monitoring',
    },
    kubePrometheus+: {
      platform: 'eks',
    },
  },
  kubernetesControlPlane+: {
    prometheusRuleEksCNI+: {
      spec+: {
        groups+: [
          {
            name: 'example-group',
            rules: [
              {
                record: 'aws_eks_available_ip',
                expr: 'sum by(instance) (awscni_total_ip_addresses) - sum by(instance) (awscni_assigned_ip_addresses) < 10',
              },
            ],
          },
        ],
      },
    },
  },
};

{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) }

then build manifests using the build.sh script.

sikachu commented 2 years ago

I ran into this issue as well.

Basically, platform: 'eks' has to be inside common:, as seen in https://github.com/prometheus-operator/kube-prometheus/pull/1286. All the documentations still needed to be updated.

local kp = (import 'kube-prometheus/main.libsonnet') + {
  values+:: {
    common+: {
      namespace: 'monitoring',
      platform: 'eks',
    },
  },

However, if you properly activate the platform, you will trigger https://github.com/prometheus-operator/kube-prometheus/issues/1147 since the eks cni addon is broken.

So, I guess the only way to use 0.8+ for now is to not use eks-specific feature, until the issue above is fixed.