Skip to content

Commit

Permalink
Merge pull request #605 from KarlisAG/add-resource-namespaces
Browse files Browse the repository at this point in the history
add namespace to all resources
  • Loading branch information
ese authored Aug 11, 2023
2 parents 102242f + 110b578 commit 0f12062
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/redisoperator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ appVersion: 1.2.4
apiVersion: v1
description: A Helm chart for the Spotahome Redis Operator
name: redis-operator
version: 3.2.8
version: 3.2.9
home: https://github.com/spotahome/redis-operator
keywords:
- "golang"
Expand Down
7 changes: 7 additions & 0 deletions charts/redisoperator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ Create the name of the service account to use
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }}
{{- end }}
{{- end }}

{{/*
Create the name of the namespace
*/}}
{{- define "chart.namespaceName" -}}
{{- default .Release.Namespace .Values.namespace }}
{{- end }}
1 change: 1 addition & 0 deletions charts/redisoperator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ $fullName }}
namespace: {{ include "chart.namespaceName" . }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
{{- if .Values.annotations }}
Expand Down
4 changes: 3 additions & 1 deletion charts/redisoperator/templates/monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ $fullName }}-prometheus
namespace: {{ include "chart.namespaceName" . }}
labels:
prometheus: {{ .Values.monitoring.prometheus.name }}
{{- include "chart.labels" $data | nindent 4 }}
Expand All @@ -28,6 +29,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ $fullName }}
namespace: {{ include "chart.namespaceName" . }}
labels:
prometheus: {{ .Values.monitoring.prometheus.name }}
{{- include "chart.labels" $data | nindent 4 }}
Expand All @@ -38,7 +40,7 @@ spec:
{{- include "chart.selectorLabels" $data | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
- {{ include "chart.namespaceName" . }}
endpoints:
- port: metrics
interval: 15s
Expand Down
1 change: 1 addition & 0 deletions charts/redisoperator/templates/private-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ $fullName }}-{{ $name }}
namespace: {{ include "chart.namespaceName" . }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
{{- if .Values.annotations }}
Expand Down
3 changes: 2 additions & 1 deletion charts/redisoperator/templates/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $fullName }}
namespace: {{ include "chart.namespaceName" . }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
---
Expand Down Expand Up @@ -106,7 +107,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "chart.namespaceName" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
1 change: 1 addition & 0 deletions charts/redisoperator/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ $fullName }}
namespace: {{ include "chart.namespaceName" . }}
labels:
{{- include "chart.labels" $data | nindent 4 }}
{{- if .Values.annotations }}
Expand Down
4 changes: 4 additions & 0 deletions charts/redisoperator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ nameOverride: ""
# A name to substitute for the full names of resources.
fullnameOverride: ""

# The name of the Namespace to deploy
# If not set, `.Release.Namespace` is used
namespace: null

serviceAccount:
# Enable service account creation.
create: true
Expand Down

0 comments on commit 0f12062

Please sign in to comment.