Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/px-central/templates/crds/crd-alertmanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ kind: CustomResourceDefinition
metadata:
name: alertmanagers.monitoring.coreos.com
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
labels:
app: prometheus-operator
Expand Down
6 changes: 4 additions & 2 deletions charts/px-central/templates/crds/crd-alertmanagerconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ For ArgoCD deployments with pre-existing CRDs, set installCRDs: "false"
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: alertmanagerconfigs.monitoring.coreos.com
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
creationTimestamp: null
name: alertmanagerconfigs.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
Expand Down
3 changes: 3 additions & 0 deletions charts/px-central/templates/crds/crd-podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ kind: CustomResourceDefinition
metadata:
name: podmonitors.monitoring.coreos.com
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
labels:
app: prometheus-operator
Expand Down
6 changes: 4 additions & 2 deletions charts/px-central/templates/crds/crd-probes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ For ArgoCD deployments with pre-existing CRDs, set installCRDs: "false"
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: probes.monitoring.coreos.com
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
creationTimestamp: null
name: probes.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
Expand Down
3 changes: 3 additions & 0 deletions charts/px-central/templates/crds/crd-prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ kind: CustomResourceDefinition
metadata:
name: prometheuses.monitoring.coreos.com
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
labels:
app: prometheus-operator
Expand Down
3 changes: 3 additions & 0 deletions charts/px-central/templates/crds/crd-prometheusrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ kind: CustomResourceDefinition
metadata:
name: prometheusrules.monitoring.coreos.com
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
labels:
app: prometheus-operator
Expand Down
5 changes: 4 additions & 1 deletion charts/px-central/templates/crds/crd-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ For ArgoCD deployments with pre-existing CRDs, set installCRDs: "false"
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: servicemonitors.monitoring.coreos.com
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
name: servicemonitors.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
Expand Down
6 changes: 4 additions & 2 deletions charts/px-central/templates/crds/crd-thanosrulers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ For ArgoCD deployments with pre-existing CRDs, set installCRDs: "false"
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: thanosrulers.monitoring.coreos.com
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation
helm.sh/hook-weight: "-5"
helm.sh/resource-policy: keep
creationTimestamp: null
name: thanosrulers.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ kind: Alertmanager
metadata:
name: px-backup-alertmanager
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "5"
labels:
{{- include "px-central.partOfLabel" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{{- $pxBackupEnabled := .Values.pxbackup.enabled | default false }}
{{- if eq $pxBackupEnabled true }}
{{- $deployDedicatedMonitoringSystem := .Values.pxbackup.deployDedicatedMonitoringSystem }}
{{- $enableExternalMetricsScraping := .Values.pxbackup.enableExternalMetricsScraping | default false }}
{{- if or (eq $deployDedicatedMonitoringSystem true) (eq $enableExternalMetricsScraping true) (eq $enableExternalMetricsScraping false) }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: px-backup-monitoring-cleanup
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
labels:
{{- include "px-central.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: px-backup-monitoring-cleanup-{{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
labels:
{{- include "px-central.labels" . | nindent 4 }}
rules:
- apiGroups: ["monitoring.coreos.com"]
resources: ["prometheuses", "alertmanagers", "servicemonitors", "prometheusrules"]
verbs: ["get", "list", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: px-backup-monitoring-cleanup-{{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-weight: "-4"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
labels:
{{- include "px-central.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: px-backup-monitoring-cleanup-{{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: px-backup-monitoring-cleanup
namespace: {{ .Release.Namespace }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: px-backup-monitoring-cleanup
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-weight: "0"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
labels:
{{- include "px-central.labels" . | nindent 4 }}
spec:
ttlSecondsAfterFinished: 100
backoffLimit: 3
template:
spec:
serviceAccountName: px-backup-monitoring-cleanup
restartPolicy: Never
containers:
- name: cleanup
image: bitnami/kubectl:latest
command:
- /bin/sh
- -c
- |
echo "Cleaning up Prometheus Operator resources..."
kubectl delete prometheus px-backup-dashboard-prometheus -n {{ .Release.Namespace }} --ignore-not-found=true
kubectl delete alertmanager px-backup-alertmanager -n {{ .Release.Namespace }} --ignore-not-found=true
kubectl delete servicemonitor px-backup-dashboard-prometheus-sm -n {{ .Release.Namespace }} --ignore-not-found=true
kubectl delete servicemonitor px-backup-external-monitoring-sm -n {{ .Release.Namespace }} --ignore-not-found=true
kubectl delete prometheusrule px-backup-dashboard-prometheus-rules -n {{ .Release.Namespace }} --ignore-not-found=true
echo "Cleanup complete!"
{{- end }}
{{- end }}
21 changes: 19 additions & 2 deletions charts/px-central/templates/px-backup/pxcentral-prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
{{- $pxMonitorEnabled := .Values.pxmonitor.enabled | default false }}
{{- $azureProxyEnabled := .Values.proxy.azureProxyEnabled | default false }}
{{- $enableExternalMetricsScraping := .Values.pxbackup.enableExternalMetricsScraping | default false }}
{{- $prometheusCRD := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "prometheuses.monitoring.coreos.com" }}
{{- if eq $deployDedicatedMonitoringSystem true }}
{{- $storageSize := "5Gi" }}
{{- $retentionSize := "4096MB" }}
{{- if $prometheusCRD }}
{{- $prometheus := lookup "monitoring.coreos.com/v1" "Prometheus" .Release.Namespace "px-backup-dashboard-prometheus" }}
{{- if $prometheus }}
{{- $storageSize = $prometheus.spec.storage.volumeClaimTemplate.spec.resources.requests.storage }}
Expand All @@ -21,7 +23,7 @@
{{- end -}}
{{- end -}}
{{- end -}}
{{- else }}
{{- end }}
{{- end }}
{{- $hasAzureAnnotation := and (eq $azureProxyEnabled true) (not (has "px-backup-dashboard-prometheus" .Values.proxy.excludeAzureProxyList)) }}
{{- $hasIstioAnnotation := .Values.istio.enabled }}
Expand Down Expand Up @@ -288,6 +290,9 @@ kind: Prometheus
metadata:
name: px-backup-dashboard-prometheus
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "5"
labels:
{{- include "px-central.partOfLabel" . | nindent 5 }}
spec:
Expand Down Expand Up @@ -513,6 +518,9 @@ kind: ServiceMonitor
metadata:
namespace: {{ .Release.Namespace }}
name: px-backup-dashboard-prometheus-sm
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "6"
labels:
name: px-backup-dashboard-prometheus-sm
app.kubernetes.io/component: px-backup
Expand Down Expand Up @@ -564,6 +572,9 @@ kind: ServiceMonitor
metadata:
namespace: {{ .Release.Namespace }}
name: px-backup-dashboard-prometheus-sm
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "6"
labels:
name: px-backup-dashboard-prometheus-sm
app.kubernetes.io/component: px-backup
Expand Down Expand Up @@ -618,6 +629,9 @@ kind: ServiceMonitor
metadata:
namespace: {{ .Release.Namespace }}
name: px-backup-external-monitoring-sm
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "6"
labels:
name: px-backup-external-monitoring-sm
app.kubernetes.io/component: px-backup
Expand Down Expand Up @@ -668,10 +682,13 @@ spec:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: px-backup-dashboard-prometheus-rules
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "6"
labels:
app: px-backup-alerts
{{- include "px-central.partOfLabel" . | nindent 4 }}
name: px-backup-dashboard-prometheus-rules
spec:
groups:
- name: gauge_rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ data:
BASE_ROOT_PATH: /
DB_PORT: "3306"
DB_DATABASE: pxcentral
FRONTEND_ENABLED_MODULES: COMPANY,LH,USERS,SSO
{{- /* Build FRONTEND_ENABLED_MODULES dynamically based on enabled features */ -}}
{{- $modules := list "COMPANY" "LH" "USERS" "SSO" }}
{{- if .Values.pxbackup.enabled }}
{{- $modules = append $modules "PXBACKUP" }}
{{- end }}
{{- if .Values.pxmonitor.enabled }}
{{- $modules = append $modules "PXMONITOR" }}
{{- end }}
{{- if .Values.pxlicenseserver.enabled }}
{{- $modules = append $modules "PXLS" }}
{{- end }}
FRONTEND_ENABLED_MODULES: {{ join "," $modules }}
PX_BACKUP_ENDPOINT: "px-backup:10002"
PX_BACKUP_ORGID: "{{ .Values.pxbackup.orgName }}"
PX_STATUS_ENDPOINT: "http://pxcentral-apiserver:10006"
OIDC_AUTHSERVERURL: http://pxcentral-keycloak-http:80/auth/realms/master
OIDC_SCOPES: openid
HIDE_KUBE_CONFIG: "False"
USE_PLATFORM_RBAC: "{{ .Values.pxbackup.usePlatformRbac }}"
USE_PLATFORM_RBAC: "{{ .Values.pxbackup.usePlatformRbac }}"
Loading