Skip to content

Commit

Permalink
feat: add namespaceOverride to support install in different namespace (
Browse files Browse the repository at this point in the history
…#301)

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Jul 9, 2024
1 parent 18d3b6e commit 0336db9
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 12 deletions.
16 changes: 8 additions & 8 deletions charts/dragonfly/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: dragonfly
description: Dragonfly is an intelligent P2P based image and file distribution system
icon: https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/main/docs/images/logo/dragonfly.svg
type: application
version: 1.1.71
appVersion: 2.1.49
version: 1.1.72
appVersion: 2.1.50
keywords:
- dragonfly
- d7y
Expand All @@ -27,7 +27,7 @@ sources:

annotations:
artifacthub.io/changes: |
- Update dependencies version.
- Add namespaceOverride to support install in different namespace for charts.
artifacthub.io/links: |
- name: Chart Source
Expand All @@ -38,15 +38,15 @@ annotations:
url: https://github.com/dragonflyoss/client
artifacthub.io/images: |
- name: manager
image: dragonflyoss/manager:v2.1.49
image: dragonflyoss/manager:v2.1.50
- name: scheduler
image: dragonflyoss/scheduler:v2.1.49
image: dragonflyoss/scheduler:v2.1.50
- name: client
image: dragonflyoss/client:v0.1.81
image: dragonflyoss/client:v0.1.82
- name: seed-client
image: dragonflyoss/client:v0.1.81
image: dragonflyoss/client:v0.1.82
- name: dfinit
image: dragonflyoss/dfinit:v0.1.81
image: dragonflyoss/dfinit:v0.1.82
dependencies:
- name: mysql
Expand Down
5 changes: 3 additions & 2 deletions charts/dragonfly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ helm delete dragonfly --namespace dragonfly-system
| manager.image.pullSecrets | list | `[]` (defaults to global.imagePullSecrets). | Image pull secrets. |
| manager.image.registry | string | `"docker.io"` | Image registry. |
| manager.image.repository | string | `"dragonflyoss/manager"` | Image repository. |
| manager.image.tag | string | `"v2.1.49"` | Image tag. |
| manager.image.tag | string | `"v2.1.50"` | Image tag. |
| manager.ingress.annotations | object | `{}` | Ingress annotations. |
| manager.ingress.className | string | `""` | Ingress class name. Requirement: kubernetes >=1.18. |
| manager.ingress.enable | bool | `false` | Enable ingress. |
Expand Down Expand Up @@ -341,6 +341,7 @@ helm delete dragonfly --namespace dragonfly-system
| mysql.migrate | bool | `true` | Running GORM migration. |
| mysql.primary.service.port | int | `3306` | Mysql port. |
| nameOverride | string | `""` | Override dragonfly name. |
| namespaceOverride | string | `""` | Override dragonfly namespace. |
| redis.auth.enabled | bool | `true` | Enable password authentication. |
| redis.auth.password | string | `"dragonfly"` | Redis password. |
| redis.clusterDomain | string | `"cluster.local"` | Cluster domain. |
Expand Down Expand Up @@ -411,7 +412,7 @@ helm delete dragonfly --namespace dragonfly-system
| scheduler.image.pullSecrets | list | `[]` (defaults to global.imagePullSecrets). | Image pull secrets. |
| scheduler.image.registry | string | `"docker.io"` | Image registry. |
| scheduler.image.repository | string | `"dragonflyoss/scheduler"` | Image repository. |
| scheduler.image.tag | string | `"v2.1.49"` | Image tag. |
| scheduler.image.tag | string | `"v2.1.50"` | Image tag. |
| scheduler.initContainer.image.digest | string | `""` | Image digest. |
| scheduler.initContainer.image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
| scheduler.initContainer.image.registry | string | `"docker.io"` | Image registry. |
Expand Down
7 changes: 7 additions & 0 deletions charts/dragonfly/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
*/}}
{{- define "common.names.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride | 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).
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/client-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dragonfly.client.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/client-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "dragonfly.client.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/dfinit-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dragonfly.dfinit.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/metrics-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.client.fullname" . }}-metrics
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "dragonfly.client.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/client/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "dragonfly.client.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/manager-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
heritage: {{ .Release.Service }}
component: {{ .Values.manager.name }}
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
annotations:
{{- if .Values.manager.deploymentAnnotations }}
{{ toYaml .Values.manager.deploymentAnnotations | indent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/manager-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/manager-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/metrics-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.manager.fullname" . }}-metrics
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/manager/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "dragonfly.manager.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/scheduler/metrics-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}-metrics
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/scheduler/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/scheduler/scheduler-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/scheduler/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "dragonfly.scheduler.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/seed-client/metrics-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.seedClient.fullname" . }}-metrics
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/seed-client/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "dragonfly.seedClient.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dragonfly.seedClient.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
heritage: {{ .Release.Service }}
component: {{ .Values.seedClient.name }}
name: {{ template "dragonfly.seedClient.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
annotations:
{{- if .Values.seedClient.statefulsetAnnotations }}
{{ toYaml .Values.seedClient.statefulsetAnnotations | indent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.seedClient.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
1 change: 1 addition & 0 deletions charts/dragonfly/templates/seed-client/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "dragonfly.seedClient.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
Expand Down
6 changes: 4 additions & 2 deletions charts/dragonfly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ nameOverride: ""
fullnameOverride: ""
# -- Install application cluster domain.
clusterDomain: "cluster.local"
# -- Override dragonfly namespace.
namespaceOverride: ""

global:
# -- Global Docker image registry.
Expand Down Expand Up @@ -37,7 +39,7 @@ manager:
# -- Image repository.
repository: dragonflyoss/manager
# -- Image tag.
tag: v2.1.49
tag: v2.1.50
# -- Image digest.
digest: ""
# -- Image pull policy.
Expand Down Expand Up @@ -331,7 +333,7 @@ scheduler:
# -- Image repository.
repository: dragonflyoss/scheduler
# -- Image tag.
tag: v2.1.49
tag: v2.1.50
# -- Image digest.
digest: ""
# -- Image pull policy.
Expand Down

0 comments on commit 0336db9

Please sign in to comment.