Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Conflicting secret name #4033

Open
applejag opened this issue Nov 22, 2023 · 4 comments
Open

[kube-prometheus-stack] Conflicting secret name #4033

applejag opened this issue Nov 22, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@applejag
Copy link

applejag commented Nov 22, 2023

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

Tried to do an update via helm upgrade, but got the error:

rendered manifests contain a resource that already exists. Unable to continue with update: Secret "prometheus-prometheus" in namespace "prometheus" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "ri-prometheus-operator"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "prometheus"

It seems to be caused by this file: https://github.com/prometheus-community/helm-charts/blob/kube-prometheus-stack-54.1.0/charts/kube-prometheus-stack/templates/prometheus/secret.yaml

Having conflicts with a file that the Prometheus Operator generates here: https://github.com/prometheus-operator/prometheus-operator/blob/v0.69.1/pkg/prometheus/statefulset.go#L122-L148

What's your helm version?

version.BuildInfo{Version:"v3.13.2", GitCommit:"v3.13.2", GitTreeState:"", GoVersion:"go1.21.3"}

What's your kubectl version?

Client Version: v1.28.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.8

Which chart?

kube-prometheus-stack

What's the chart version?

54.1.0

What happened?

The secret from this chart is for Thanos stuff, and I don't even use Thanos. The secret that's blocking my upgrades is an empty secret.

What you expected to happen?

The secret deployed by this chart does not have a conflicting name.

How to reproduce it?

No response

Enter the changed values of values.yaml?

fullnameOverride: prometheus
cleanPrometheusOperatorObjectNames: true

Enter the command that you execute and failing/misfunctioning.

helm upgrade ri-prometheus-operator ./ -f path-to-my-values/values.yaml

Anything else we need to know?

No response

@applejag applejag added the bug Something isn't working label Nov 22, 2023
@aldemira
Copy link

aldemira commented Nov 27, 2023

I've the exact same problem. Not a permanent solution but I edited the secret manually with:
kubectl edit secret prometheus-prometheus -n prometheus
And added following lines (for some reason this object didn't have any annotations, which is odd.)

annotations:
meta.helm.sh/release-name: prometheus
meta.helm.sh/release-namespace: prometheus

I've also changed:

labels:
managed-by: prometheus-operator

to:

labels:
app.kubernetes.io/managed-by: "Helm"

And upgrade worked without any issues after that.

@timebertt
Copy link

Seems to be caused by #3918 (version 52).
cc @thameezb

The secret is always created

even if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.secret is not set, which is the condition in the ThanosRuler object

{{- else if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.secret }}
alertmanagersConfig:
key: alertmanager-configs.yaml
name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
{{- end }}

Note, that an empty secret will be created if .Values.thanosRuler.thanosRulerSpec.alertmanagersConfig.secret is not set:

{{- with .Values.prometheus.prometheusSpec.thanos.objectStorageConfig }}
{{- if and .secret (not .existingSecret) }}
object-storage-configs.yaml: {{ toYaml .secret | b64enc | quote }}
{{- end }}
{{- end }}

@mohamedezz96
Copy link

i am facing the same problem is there a solution instead editing the existing secret manual ?

@applejag
Copy link
Author

applejag commented Feb 2, 2024

We solved it by not setting cleanPrometheusOperatorObjectNames. The pod names are a bit ugly, but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants