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

PB-7128 : Changes for px-backup 2.7.0 release #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
5 changes: 2 additions & 3 deletions px-central/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ keywords:
name: px-central
sources:
- https://github.com/portworx/aws-helm/tree/master/charts/px-central
version: 2.6.0
appVersion: 2.6.0
name: px-central
version: 2.7.0
appVersion: 2.7.0
327 changes: 327 additions & 0 deletions px-central/templates/px-backup/pxcentral-alertmanager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
{{- $isOpenshiftCluster := .Capabilities.APIVersions.Has "apps.openshift.io/v1" -}}
{{- $deployDedicatedMonitoringSystem := .Values.pxbackup.deployDedicatedMonitoringSystem }}
{{- if eq $deployDedicatedMonitoringSystem true }}
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
name: px-backup-alertmanager
namespace: {{ .Release.Namespace }}
spec:
configSecret: px-backup-alertmanager-custom-config
alertmanagerConfigSelector:
matchLabels:
app: px-backup-alert-configs
replicas: {{ .Values.pxbackup.alertmanager.replicas }}
{{- if .Values.images.pullSecrets }}
imagePullSecrets:
{{- range $sec := .Values.images.pullSecrets }}
- name: {{ $sec | quote }}
{{- end }}
{{- end }}
retention: {{ .Values.pxbackup.alertmanager.retention}}
containers:
- args:
- '--config.file=/etc/alertmanager/config_out/alertmanager.env.yaml'
- '--storage.path=/alertmanager'
- '--data.retention={{ .Values.pxbackup.alertmanager.retention }}'
- '--cluster.listen-address=[$(POD_IP)]:9094'
- '--web.listen-address=:9093'
- '--web.route-prefix=/'
- '--cluster.label={{ .Release.Namespace }}/px-backup-alertmanager'
- '--cluster.peer=alertmanager-px-backup-alertmanager-0.alertmanager-operated:9094'
- '--cluster.peer=alertmanager-px-backup-alertmanager-1.alertmanager-operated:9094'
- '--cluster.reconnect-timeout=5m'
- '--web.config.file=/etc/alertmanager/web_config/web-config-custom.yaml'
env:
- name: AUTH_SECRET
valueFrom:
secretKeyRef:
name: pxc-backup-metrics
key: metrics-token
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
image: {{ printf "%s/%s/%s:%s" .Values.images.pxBackupAlertmanagerImage.registry .Values.images.pxBackupAlertmanagerImage.repo .Values.images.pxBackupAlertmanagerImage.imageName .Values.images.pxBackupAlertmanagerImage.tag }}
name: alertmanager
ports:
- containerPort: 9093
name: web
protocol: TCP
- args:
- --listen-address=:8080
- --reload-url=http://$(USERNAME):$(PASSWORD)@localhost:9093/-/reload
- --config-file=/etc/alertmanager/config/alertmanager.yaml.gz
- --config-envsubst-file=/etc/alertmanager/config_out/alertmanager.env.yaml
- --watched-dir=/etc/alertmanager/config
env:
- name: USERNAME
valueFrom:
secretKeyRef:
key: username
name: pxc-backup-metrics
- name: PASSWORD
valueFrom:
secretKeyRef:
key: password
name: pxc-backup-metrics
name: config-reloader
ports:
- containerPort: 8080
name: reloader-web
protocol: TCP
{{- if $isOpenshiftCluster }}
{{- else }}
securityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
{{- end }}
listenLocal: true
volumeMounts:
- mountPath: /etc/alertmanager/web_config/web-config-custom.yaml
name: web-config-custom
readOnly: true
subPath: web-config-custom.yaml
volumes:
- name: web-config-custom
secret:
defaultMode: 420
secretName: pxc-backup-metrics
{{- if .Values.persistentStorage.storageClassName }}
storage:
volumeClaimTemplate:
spec:
storageClassName: {{ .Values.persistentStorage.storageClassName }}
resources:
requests:
storage: {{ .Values.persistentStorage.alertManager.storage }}
{{- end }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: px-backup-alertmanager-custom-config
type: Opaque
stringData:
alertmanager.yaml: |
route:
receiver: "null"
receivers:
- name: "null"
templates: [ "/etc/alertmanager/config/*.tmpl" ]
pxc_template.tmpl: |
{{`<!DOCTYPE html>
<html>
<head>
<title>Portworx-Backup Email</title>
<style>
body {
font-family: "Calibri", sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
background-color: #f4f4f4;
}
.container {
margin: 20px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
}
p {
color: #666;
}
li {
color: #292929;
font-size: 14px;
font-style: normal;
font-weight: 400;
margin-bottom: 5 px;
}
.bold-text {
padding-left: 20px;
font-weight: bold;
}
.pb-16,
li {
padding-bottom: 10px;
}
</style>
</head>
<body>
<div class="container">
<img style="height: 33px; width: 89px;" src="https://portworx.com/wp-content/themes/portworx/assets/images/header/portworx-logo.png" alt="" srcset="">
{{ range .Alerts }}
{{- if eq .Labels.alertname "ClusterAlert"}}
<div
class="pb-16"
style="margin: 22px 0px;width: 400px; color: #bc1b06; font-size: 18px; font-weight: 500">
Critical Alert: Cluster Disconnected
</div>
<div
class="pb-16"
style="
color: var(--content-onBase-strong, #292929);
font-size: 15px;
font-weight: 700;
"
>
Alert details:
</div>
<ul>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Cluster Name:</div>
<div>{{ .Labels.name }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Error:</div>
<div>{{ .Labels.error_reason }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Alert Creation Time:</div>
<div>{{ .StartsAt.Format "2006-01-02 15:04:05" }}</div>
</div>
</li>
</ul>
{{- else if eq .Labels.alertname "BackupAlert" }}
<div
class="pb-16"
style="margin: 22px 0px;width: 400px; color: #bc1b06; font-size: 18px; font-weight: 500">
Critical Alert: Backup Failed
</div>
<div
class="pb-16"
style="
color: var(--content-onBase-strong, #292929);
font-size: 15px;
font-weight: 700;
"
>
Alert details:
</div>
<ul>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Backup name:</div>
<div>{{ .Labels.name }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Cluster name:</div>
<div>{{ .Labels.cluster }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Error:</div>
<div>{{ .Labels.error_reason }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Alert Creation Time:</div>
<div>{{ .StartsAt.Format "2006-01-02 15:04:05" }}</div>
</div>
</li>
</ul>
{{- else if eq .Labels.alertname "RestoreAlert" }}
<div
class="pb-16"
style="margin: 22px 0px;width: 400px; color: #bc1b06; font-size: 18px; font-weight: 500">
Critical Alert: Restore Failed
</div>
<div
class="pb-16"
style="
color: var(--content-onBase-strong, #292929);
font-size: 15px;
font-weight: 700;
"
>
Alert details:
</div>
<ul>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Restore name:</div>
<div>{{ .Labels.name }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Cluster name:</div>
<div>{{ .Labels.cluster }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Error:</div>
<div>{{ .Labels.error_reason }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Alert Creation Time:</div>
<div>{{ .StartsAt.Format "2006-01-02 15:04:05" }}</div>
</div>
</li>
</ul>
{{- else if eq .Labels.alertname "BackupLocationAlert" }}
<div
class="pb-16"
style="margin: 22px 0px;width: 400px; color: #bc1b06; font-size: 18px; font-weight: 500">
Critical Alert: Backup Location Disconnected
</div>
<div
class="pb-16"
style="
color: var(--content-onBase-strong, #292929);
font-size: 16px;
font-weight: 700;
"
>
Alert details:
</div>
<ul>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Backup Location name:</div>
<div>{{ .Labels.name }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Error:</div>
<div>{{ .Labels.error_reason }}</div>
</div>
</li>
<li>
<div style="display: flex">
<div style="font-weight: bold; width: 170px;min-width: 170px;">Alert Creation Time:</div>
<div>{{ .StartsAt.Format "2006-01-02 15:04:05" }}</div>
</div>
</li>
</ul>
{{- end }}
{{ end }}
<div style="font-size: 14px" class="pb-16">
Please login to your Portworx Backup deployment to view more details and
take corrective actions.
</div>
</div>
</body>
</html>`}}
8 changes: 8 additions & 0 deletions px-central/templates/px-backup/pxcentral-backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get"]
{{- if eq $nfsEnabled true }}
- apiGroups: [""]
resources: ["persistentvolumes"]
Expand Down Expand Up @@ -86,6 +89,9 @@ rules:
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list"]
- apiGroups: ["monitoring.coreos.com"]
resources: ["alertmanagerconfigs"]
verbs: ["get","create","delete","update","list","deletecollection"]
{{- if eq $nfsEnabled true }}
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
Expand Down Expand Up @@ -201,6 +207,8 @@ spec:
value: {{ .Values.pxbackup.orgName }}
- name: PX_BACKUP_DEFAULT_DATASTORE
value: mongodb
- name: USE_PX_BACKUP_EMAIL_ALERT_TEMPLATE
value: "{{ .Values.pxbackup.usePxBackupEmailAlertTemplate }}"
- name: SOFT_LICENSING_PERIOD
value: "30"
- name: AIRGAP_REPORTING_PERIOD
Expand Down
Loading