Skip to content

Commit

Permalink
[ENHANCEMENT] Refactoring Kubernetes labels (#19)
Browse files Browse the repository at this point in the history
* Update: Refactoring Kubernetes labels

Signed-off-by: Nicolas Lamirault <[email protected]>

* [DOC] Generate README with additional label objects

Signed-off-by: Ronny Trommer <[email protected]>

---------

Signed-off-by: Nicolas Lamirault <[email protected]>
Signed-off-by: Ronny Trommer <[email protected]>
Co-authored-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
indigo423 and nlamirault authored Aug 21, 2024
1 parent 14cc255 commit 5e60e7a
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/perses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ helm delete my-release

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalLabels | object | `{}` | |
| annotations | object | `{}` | Statefulset Annotations |
| config | object | `{"annotations":{},"database":{"file":{"extension":"json","folder":"/perses"},"sql":{}},"important_dashboards":[],"provisioning":{"folders":["/etc/perses/datasources"]},"schemas":{"datasources_path":"/etc/perses/cue/schemas/datasources","interval":"5m","panels_path":"/etc/perses/cue/schemas/panels","queries_path":"/etc/perses/cue/schemas/queries","variables_path":"/etc/perses/cue/schemas/variables"},"security":{"cookie":{"same_site":"lax","secure":false},"enableAuth":false,"readOnly":false}}` | Perses configuration file ref: https://github.com/perses/perses/blob/main/docs/user-guides/configuration.md |
| config.annotations | object | `{}` | Annotations for config |
Expand Down
4 changes: 4 additions & 0 deletions charts/perses/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ helm.sh/chart: {{ include "perses.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/part-of: {{ include "perses.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels }}
{{- end }}
{{- end }}

{{/*
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: {{ include "perses.fullname" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: configuration
{{- with .Values.config.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/datasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ include "perses.fullname" . }}-datasources
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: configuration
data:
{{- range $.Values.datasources }}
{{ .metadata.name | lower }}.json: |-
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ include "perses.fullname" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ include "perses.fullname" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: storage
{{- with .Values.persistence.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: {{ include "perses.fullname" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ include "perses.serviceAccountName" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: iam
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/perses/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: {{ include "perses.fullname" . }}
labels:
{{- include "perses.labels" . | nindent 4 }}
app.kubernetes.io/component: workload
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions charts/perses/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"pullPolicy"
]
},
"additionalLabels": {
"type": "object"
},
"service": {
"type": "object",
"additionalProperties": false,
Expand Down
3 changes: 3 additions & 0 deletions charts/perses/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ image:
# -- Default image pull policy
pullPolicy: IfNotPresent

additionalLabels: {}
# app: perses

# -- Service account for Perses to use.
serviceAccount:
# -- Specifies whether a service account should be created
Expand Down

0 comments on commit 5e60e7a

Please sign in to comment.