Skip to content

Commit

Permalink
Chart para prometheus
Browse files Browse the repository at this point in the history
Correcao do bug no chart do csi do proxmox
  • Loading branch information
Daniel Ramos committed Aug 10, 2024
1 parent 31dab69 commit 3062338
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 5 deletions.
Binary file removed openshift-proxmox-csi-plugin-0.0.3.tgz
Binary file not shown.
Binary file removed openshift-proxmox-csi-plugin-0.0.4.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions openshift-proxmox-csi-plugin/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: v0.7.0
appVersion: v0.0.1
description: A CSI plugin for Proxmox + Openshift
home: https://github.com/daniframos/charts/tree/master/openshift-proxmox-csi-plugin
keywords:
Expand All @@ -13,4 +13,4 @@ name: openshift-proxmox-csi-plugin
sources:
- https://github.com/daniframos/charts/tree/master/openshift-proxmox-csi-plugin
type: application
version: 0.0.3
version: 0.0.1
2 changes: 1 addition & 1 deletion openshift-proxmox-csi-plugin/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: controller
{{- end }}

{{- define "proxmox-csi-plugin-node.selectorLabels" -}}
{{- define "openshift-proxmox-csi-plugin-node.selectorLabels" -}}
app.kubernetes.io/name: {{ include "openshift-proxmox-csi-plugin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: node
Expand Down
4 changes: 2 additions & 2 deletions openshift-proxmox-csi-plugin/templates/node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ spec:
type: {{ .Values.updateStrategy.type }}
selector:
matchLabels:
{{- include "proxmox-csi-plugin-node.selectorLabels" . | nindent 6 }}
{{- include "openshift-proxmox-csi-plugin-node.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "proxmox-csi-plugin-node.selectorLabels" . | nindent 8 }}
{{- include "openshift-proxmox-csi-plugin-node.selectorLabels" . | nindent 8 }}
spec:
priorityClassName: system-node-critical
{{- with .Values.imagePullSecrets }}
Expand Down
23 changes: 23 additions & 0 deletions prometheus/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions prometheus/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: prometheus
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions prometheus/charts/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "prometheus.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
data:
prometheus.yml: |
global:
scrape_interval: 10s
external_labels:
system: quarkus-super-heroes
scrape_configs:
- job_name: k8s-discovery
kubernetes_sd_configs:
- role: pod
namespaces:
own_namespace: true
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
action: keep
regex: true
- source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_path
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels:
- __address__
- __meta_kubernetes_pod_annotation_prometheus_io_port
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels:
- __meta_kubernetes_namespace
action: replace
target_label: kubernetes_namespace
- source_labels:
- __meta_kubernetes_pod_name
action: replace
target_label: kubernetes_pod_name
- job_name: teste
scheme: https
metrics_path: /q/metrics
static_configs: []
- job_name: homologacao
scheme: https
metrics_path: /q/metrics
static_configs: []
- job_name: producao
scheme: https
metrics_path: /q/metrics
static_configs: []
- job_name: desenvolvimento
scheme: https
metrics_path: /q/metrics
static_configs: []
52 changes: 52 additions & 0 deletions prometheus/charts/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "prometheus.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: {{ .Values.updateStrategy.type }}
rollingUpdate:
{{- toYaml .Values.updateStrategy.rollingUpdate | nindent 6 }}
selector:
matchLabels:
{{- include "prometheus.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
annotations:
checksum/config: {{ toJson .Values.config | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "prometheus.selectorLabels" . | nindent 8 }}
spec:
containers:
- image: "{{ .Values.deployment.image.repository }}:{{ .Values.controller.plugin.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
livenessProbe: {{ toYaml .Values.deployment.livenessProbe | nindent 12 }}
name: {{ include "prometheus.name" . }}
ports:
- containerPort: {{ .Values.deployment.port }}
name: tcp-{{ .Values.deployment.image.pullPolicy }}
protocol: TCP
readinessProbe: {{ toYaml .Values.deployment.readinessProbe | nindent 12 }}
resources: {}
volumeMounts:
- mountPath: /prometheus
name: prometheus-data
- mountPath: /etc/prometheus
name: {{ include "prometheus.fullname" . }}-config
volumes:
- name: prometheus-data
persistentVolumeClaim:
claimName: {{ include "prometheus.fullname" . }}-pvc
- configMap:
defaultMode: 420
name: {{ include "prometheus.fullname" . }}-config
name: {{ include "prometheus.fullname" . }}-config
15 changes: 15 additions & 0 deletions prometheus/charts/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "prometheus.fullname" . }}-pvc
namespace: {{ .Release.Namespace }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.storage.size }}
storageClassName: {{ .Values.storage.storageClass}}
volumeMode: Filesystem
21 changes: 21 additions & 0 deletions prometheus/charts/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ include "prometheus.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
spec:
host: {{ include "prometheus.fullname" . }}.{{ .Values.openshift.dominio }}
port:
targetPort: {{ .Values.deployment.port }}
tls:
insecureEdgeTerminationPolicy: Allow
termination: edge
to:
kind: Service
name: {{ include "prometheus.fullname" . }}
weight: 100
wildcardPolicy: None
17 changes: 17 additions & 0 deletions prometheus/charts/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "prometheus.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "prometheus.labels" . | nindent 4 }}
spec:
ports:
- name: TCP
port: {{ .Values.deployment.port }}
protocol: TCP
targetPort: {{ .Values.deployment.port }}
selector:
deployment: {{ include "prometheus.fullname" . }}
sessionAffinity: None
type: ClusterIP
52 changes: 52 additions & 0 deletions prometheus/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheus.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "prometheus.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "prometheus.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "prometheus.labels" -}}
helm.sh/chart: {{ include "prometheus.chart" . }}
app.kubernetes.io/name: {{ include "prometheus.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "prometheus.selectorLabels" -}}
app.kubernetes.io/name: {{ include "prometheus.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
40 changes: 40 additions & 0 deletions prometheus/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
nameOverride: ""
fullnameOverride: ""

deployment:
image:
repository: prom/prometheus
pullPolicy: IfNotPresent
tag: "v2.43.0"
pullPolicy: IfNotPresent

livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9090
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 120

readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 9090
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 120

port: 9090

storage:
size: 10Gi
storageClass: proxmox-data-xfs

openshift:
dominio: apps.ocp.dani.framos.nom.br

0 comments on commit 3062338

Please sign in to comment.