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

Refactoring labels #101

Merged
merged 8 commits into from
Jun 3, 2024
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file.
## Added
- Option to override Relay external host in config from [plejik](https://github.com/plejik)

### Changed
- Updated Kubernetes labels from [nlamirault](https://github.com/nlamirault)

## [0.2.6] - 2023-09-25

### Changed
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ helm show values paralus/ztka

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalLabels | object | `{}` | Additional labels to add to all resources |
| affinity | object | `{}` | |
| auditLogs.storage | string | `"database"` | database(postgres) by default |
| autoscaling.enabled | bool | `false` | |
Expand Down
6 changes: 6 additions & 0 deletions charts/ztka/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ helm.sh/chart: {{ include "ztka.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/part-of: paralus
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels }}
{{- end }}
{{- end }}

{{- define "ztka.kratos.hooks.labels" -}}
helm.sh/chart: {{ include "ztka.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/component: kratos
app.kubernetes.io/part-of: paralus
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

Expand Down
5 changes: 5 additions & 0 deletions charts/ztka/templates/configmap-fluentbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: fluentbit-config
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/name: fluentbit
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: configuration
data:
custom_parsers.conf: |
[PARSER]
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/configmap-kratos-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: kratos-config-hooks
labels:
{{- include "ztka.kratos.hooks.labels" . | nindent 4 }}
app.kubernetes.io/name: kratos-config-hooks
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: configuration
data:
kratos-config-hooks.yaml: |
selfservice:
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/configmap-kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ metadata:
name: kratos-config
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/name: kratos-config
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: configuration
data:
serve_public_base_url: {{ include "ztka.consoleFQDNWithScheme" . }}
default_browser_return_url: {{ include "ztka.consoleFQDNWithScheme" . }}
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/configmap-paralus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.paralus "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: configuration
data:
DEV: "false"
AUDIT_LOG_FILE: "/audit-logs/audit.log"
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/configmap-prompt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.prompt "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: configuration
data:
DEV: "false"
AUDIT_LOG_FILE: "/audit-logs/audit.log"
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/configmap-relay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.relay "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: configuration
data:
PARALUS_RELAY_PEERSERVICE: https://paralus:10001
SENTRY_ADDR: paralus:10000
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/deployment-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.dashboard "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: workload
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand All @@ -19,7 +20,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ztka.labels" . | nindent 8 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.dashboard "release" $.Release) | nindent 8 }}
app.kubernetes.io/component: workload
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/deployment-paralus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.paralus "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: workload
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand All @@ -20,7 +21,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ztka.labels" . | nindent 8 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.paralus "release" $.Release) | nindent 8 }}
app.kubernetes.io/component: workload
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/deployment-prompt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.prompt "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: workload
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand All @@ -19,7 +20,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ztka.labels" . | nindent 8 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.prompt "release" $.Release) | nindent 8 }}
app.kubernetes.io/component: workload
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/deployment-relay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.relay "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: workload
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand All @@ -19,7 +20,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ztka.labels" . | nindent 8 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.relay "release" $.Release) | nindent 8 }}
app.kubernetes.io/component: workload
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: paralus
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: autoscaling
spec:
scaleTargetRef:
apiVersion: apps/v1
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/templates/httpproxy-console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: console
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
spec:
virtualhost:
fqdn: {{ include "ztka.consoleFQDN" . | quote }}
Expand Down
6 changes: 6 additions & 0 deletions charts/ztka/templates/httpproxy-ztka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: ztka-core-connector
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
spec:
virtualhost:
fqdn: {{ include "ztka.coreConnectorFQDN" . | quote }}
Expand All @@ -17,6 +20,9 @@ apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
name: ztka-user
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
spec:
virtualhost:
fqdn: {{ include "ztka.userFQDN" . | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/ingress-console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
name: console
labels:
{{- include "ztka.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/ztka/templates/ingress-ztka.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ metadata:
name: ztka
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
annotations:
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
Expand Down
8 changes: 8 additions & 0 deletions charts/ztka/templates/job-kratos-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ metadata:
helm.sh/hook: post-upgrade,post-rollback
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-2"
labels:
{{- include "ztka.labels" . | nindent 4 }}
rules:
- apiGroups: ["apps"]
resources: ["deployments"]
Expand All @@ -34,6 +36,9 @@ metadata:
helm.sh/hook: post-upgrade,post-rollback
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "-1"
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: job
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand All @@ -51,6 +56,9 @@ metadata:
helm.sh/hook: post-upgrade,post-rollback
helm.sh/hook-delete-policy: hook-succeeded
helm.sh/hook-weight: "0"
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: job
spec:
backoffLimit: 2
activeDeadlineSeconds: 600
Expand Down
5 changes: 3 additions & 2 deletions charts/ztka/templates/job-paralus-post-install-analytics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ metadata:
name: paralus-post-install-analytics
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: job
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
helm.sh/hook: post-install
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
metadata:
Expand Down
5 changes: 3 additions & 2 deletions charts/ztka/templates/job-paralus-post-upgrade-analytics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ metadata:
name: paralus-post-upgrade-analytics
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: job
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
helm.sh/hook: post-upgrade
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
metadata:
Expand Down
5 changes: 3 additions & 2 deletions charts/ztka/templates/job-paralus-pre-upgrade-analytics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ metadata:
name: paralus-pre-upgrade-analytics
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: job
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
helm.sh/hook: pre-upgrade
helm.sh/hook-delete-policy: hook-succeeded
spec:
template:
metadata:
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/secret-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: paralus-db
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: secret
type: Opaque
data:
DB_ADDR: {{ include "ztka.dbAddr" . | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/secret-kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: kratos
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: secret
type: Opaque
data:
dsn: {{ include "ztka.dsn" . | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/secret-postgresql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: postgresql
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: secret
type: Opaque
data:
password: {{ .Values.postgresql.auth.password | b64enc | quote }}
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/service-paralus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.paralus "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: networking
spec:
type: {{ .Values.services.paralus.type }}
ports:
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/service-prompt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.prompt "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: networking
spec:
type: {{ .Values.services.prompt.type }}
ports:
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/service-relay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
labels:
{{- include "ztka.labels" . | nindent 4 }}
{{- include "ztka.selectorLabels" (dict "image" $.Values.images.relay "release" $.Release) | nindent 4 }}
app.kubernetes.io/component: networking
spec:
type: {{ .Values.services.relay.type }}
ports:
Expand Down
1 change: 1 addition & 0 deletions charts/ztka/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: {{ include "ztka.serviceAccountName" . }}
labels:
{{- include "ztka.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions charts/ztka/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ serviceAccount:
# -- Annotations for the all deployed pods
podAnnotations: {}

# -- Additional labels to add to all resources
additionalLabels: {}

# Pod Security Context
podSecurityContext: {}
# fsGroup: 2000
Expand Down
Loading