prometheus-community/helm-charts

[prometheus-kube-stack] Unknown Field `spec.receivers[1].discordConfigs.apiURL`

magnusmccune opened this issue · 2 comments

Describe the bug a clear and concise description of what the bug is.

I am trying to deploy an AlertmanagerConfig resource with receiver of type discord_config but I am receiving an error. I updated Helm, deployments, CRDs and anything else I could think of.

If I use apiVersion: monitoring.coreos.com/v1alpha1 and a config like this:

apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: discord-receiver
  namespace: monitoring
spec:
  ...
  receivers:    
    - name: discord-receiver
      discordConfigs:
        apiURL:
          name: discord-secret
          key: discord-secret

I receive the error:

Error from server (BadRequest): error when creating "alertmanager-config.yaml": AlertmanagerConfig in version "v1alpha1" cannot be handled as a AlertmanagerConfig: strict decoding error: unknown field "spec.receivers[1].discordConfigs.apiURL"

This seems to indicate that apiURL doesn't exist in the API reference


If I use apiVersion: monitoring.coreos.com/v1beta1 and the same config with the updated apiVersion, I receive an error like this:

error: resource mapping not found for name: "discord-receiver" namespace: "monitoring" from "alertmanager-config.yaml": no matches for kind "AlertmanagerConfig" in version "monitoring.coreos.com/v1beta1"
ensure CRDs are installed first

This seems to indicate that I don't have CRDs that support the beta API

What's your helm version?

version.BuildInfo{Version:"v3.13.1", GitCommit:"3547a4b5bf5edb5478ce352e18858d8a552a4110", GitTreeState:"clean", GoVersion:"go1.20.8"}

What's your kubectl version?

Client Version: v1.28.9 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.0+k3s1

Which chart?

prometheus-kube-stack

What's the chart version?

60.0.2

What happened?

I applied the config and received the error:

Error from server (BadRequest): error when creating "alertmanager-config.yaml": AlertmanagerConfig in version "v1alpha1" cannot be handled as a AlertmanagerConfig: strict decoding error: unknown field "spec.receivers[1].discordConfigs.apiURL"

What you expected to happen?

I expected the deployment to complete and to be able to check my Alertmanager config and see the merged config

How to reproduce it?

kubectl apply -f alertmanager-config.yaml

alertmanager-config.yaml

apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: discord-receiver
  namespace: monitoring
spec:
  route:
    groupBy: ['alertname', 'job']
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 3h
    receiver: discord-receiver
  receivers:    
    - name: discord-receiver
      discordConfigs:
        apiURL:
          name: discord-secret
          key: discord-secret

Enter the changed values of values.yaml?

NONE

Enter the command that you execute and failing/misfunctioning.

kubectl apply -f alertmanager-config.yaml

Anything else we need to know?

No response

spec.receivers.discordConfigs is a list:

...
  receivers:    
    - name: discord-receiver
      discordConfigs:
        - apiURL:
            name: discord-secret
            key: discord-secret

Thanks @zeritti, that solved it. I really wish I could lint my own brain sometime.