feature: update helm charts (#385)

Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
Jim Ma 2021-06-30 17:32:42 +08:00 committed by Gaius
parent fe01167a4b
commit 008ae863f7
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
13 changed files with 251 additions and 119 deletions

View File

@ -68,7 +68,7 @@ Please refer to our [Code of Conduct][codeconduct].
[codeconduct]: CODE_OF_CONDUCT.md
[introduction]: https://github.com/dragonflyoss/Dragonfly2
[installation]: https://github.com/dragonflyoss/Dragonfly2
[quickstart]: https://github.com/dragonflyoss/Dragonfly2
[quickstart]: https://github.com/dragonflyoss/Dragonfly2/blob/main/docs/en/user-guide/quick-start.md
[website]: https://d7y.io
[discussion]: https://github.com/dragonflyoss/Dragonfly2/discussions
[logo-linear]: docs/en/images/logo/dragonfly-linear.svg

View File

@ -73,7 +73,7 @@ data:
server {
listen {{ .Values.cdn.service.nginxTargetPort }};
location / {
root {{ .Values.cdn.config.plugins.storage.config.baseDir }};
root {{ with $s := index .Values.cdn.config.plugins.storageDriver 0 }}{{ $s.config.baseDir }} {{ end -}};
}
}
}

View File

@ -0,0 +1,33 @@
{{- if .Values.scheduler.config.staticCDN }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{template "dragonfly.cdn.fullname" . }}-role
namespace: {{ .Values.installation.namespace }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- update
- patch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{template "dragonfly.cdn.fullname" . }}-role-binding
namespace: {{ .Values.installation.namespace }}
roleRef:
kind: Role
name: {{template "dragonfly.cdn.fullname" . }}-role
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{template "dragonfly.cdn.fullname" . }}
{{ end }}

View File

@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{template "dragonfly.cdn.fullname" . }}
namespace: {{ .Values.installation.namespace }}

View File

@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
labels:
app: {{ template "dragonfly.cdn.fullname" . }}
@ -9,9 +9,9 @@ metadata:
release: {{ .Release.Name }}
name: {{ template "dragonfly.cdn.fullname" . }}
namespace: {{ .Values.installation.namespace }}
{{- if .Values.cdn.deploymentAnnotations }}
{{- if .Values.cdn.statefulsetAnnotations }}
annotations:
{{ toYaml .Values.cdn.deploymentAnnotations | indent 4 }}
{{ toYaml .Values.cdn.statefulsetAnnotations | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.cdn.replicas }}
@ -20,6 +20,7 @@ spec:
app: {{ template "dragonfly.cdn.fullname" . }}
component: "{{ .Values.cdn.name }}"
release: {{ .Release.Name }}
serviceName: cdn
template:
metadata:
labels:
@ -31,6 +32,7 @@ spec:
{{ toYaml .Values.cdn.podAnnotations | indent 8 }}
{{- end }}
spec:
serviceAccountName: {{template "dragonfly.cdn.fullname" . }}
{{- if .Values.cdn.nodeSelector }}
nodeSelector:
{{ toYaml .Values.cdn.nodeSelector | indent 8 }}
@ -66,6 +68,53 @@ spec:
- name: nginx-config
mountPath: "/etc/nginx/nginx.conf"
subPath: "nginx.conf"
{{- if .Values.scheduler.config.staticCDN }}
initContainers:
- name: update-configmap
image: bitnami/kubectl
command:
- /bin/bash
- -xc
- |
HOSTNAME=$(cat /etc/hostname)
cat <<EOF > /tmp/patch.json
{
"data": {
"$POD_NAME.json": "{\"host_info\": {\"host_name\": \"$HOSTNAME\",\"ip\":\"$POD_IP\"},\"rpc_port\": 8003,\"down_port\": 8001}"
}
}
EOF
echo data to patch:
cat /tmp/patch.json
for i in `seq 1 10`; do
kubectl -n $POD_NAMESPACE \
patch configmap scheduler-static-cdn --type=merge \
--patch-file /tmp/patch.json
if [[ "$?" -eq 0 ]]; then
echo updated configmap:
kubectl -n $POD_NAMESPACE get configmap scheduler-static-cdn -oyaml
break
fi
done
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
imagePullPolicy: "Always"
{{- end}}
volumes:
- name: config
configMap:

View File

@ -9,19 +9,18 @@ metadata:
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
dfget-daemon.yaml: |-
dfget.yaml: |-
alive_time: {{ .Values.dfdaemon.config.alive_time }}
gc_interval: {{ .Values.dfdaemon.config.gc_interval }}
pid_file: {{ .Values.dfdaemon.config.pid_file }}
lock_file: {{ .Values.dfdaemon.config.lock_file }}
data_dir: {{ .Values.dfdaemon.config.data_dir }}
work_home: {{ .Values.dfdaemon.config.work_home }}
keep_storage: {{ .Values.dfdaemon.config.keep_storage }}
verbose: {{ .Values.dfdaemon.config.verbose }}
scheduler:
net_addrs:
- type: tcp
addr: {{template "dragonfly.scheduler.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.scheduler.service.port }}
{{- $count := .Values.scheduler.replicas | int}}
{{- range $i, $x := until $count }}
- type: tcp
addr: {{template "dragonfly.scheduler.fullname" $ }}-{{$i}}.{{ $.Release.Namespace }}.svc{{ $.Values.installation.clusterDomain }}:{{ $.Values.scheduler.service.port }}
{{- end }}
schedule_timeout: 5m
host:
{{ toYaml .Values.dfdaemon.config.host | indent 6 }}
@ -32,4 +31,16 @@ data:
storage:
{{ toYaml .Values.dfdaemon.config.storage | indent 6 }}
proxy:
{{ toYaml .Values.dfdaemon.config.proxy | indent 6 }}
tcp_listen:
{{- if not .Values.dfdaemon.hostNetwork }}
namespace: /host/ns/net
{{- end }}
listen: {{ .Values.dfdaemon.config.proxy.tcp_listen.listen }}
port: {{ .Values.dfdaemon.config.proxy.tcp_listen.port }}
security:
{{ toYaml .Values.dfdaemon.config.proxy.security | indent 8 }}
registry_mirror:
{{ toYaml .Values.dfdaemon.config.proxy.registry_mirror | indent 8 }}
proxies:
{{ toYaml .Values.dfdaemon.config.proxy.proxies | indent 8 }}

View File

@ -9,12 +9,11 @@ metadata:
component: "{{ .Values.dfdaemon.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.dfdaemon.deploymentAnnotations }}
{{- if .Values.dfdaemon.daemonsetAnnotations }}
annotations:
{{ toYaml .Values.dfdaemon.deploymentAnnotations | indent 4 }}
{{ toYaml .Values.dfdaemon.daemonsetAnnotations | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.dfdaemon.replicas }}
selector:
matchLabels:
app: {{ template "dragonfly.dfdaemon.fullname" . }}
@ -35,6 +34,7 @@ spec:
nodeSelector:
{{ toYaml .Values.dfdaemon.nodeSelector | indent 8 }}
{{- end }}
hostNetwork: {{ .Values.dfdaemon.hostNetwork }}
{{- if .Values.dfdaemon.tolerations }}
tolerations:
{{ toYaml .Values.dfdaemon.tolerations | indent 8 }}
@ -55,17 +55,29 @@ spec:
imagePullPolicy: {{ .Values.dfdaemon.pullPolicy | quote }}
resources:
{{ toYaml .Values.dfdaemon.resources | indent 12 }}
{{- if .Values.dfdaemon.hostNetwork }}
ports:
- containerPort: 65001
hostPort: 65001
protocol: TCP
{{- end}}
volumeMounts:
- name: config
mountPath: "/etc/dragonfly"
{{- if not .Values.dfdaemon.hostNetwork }}
- name: netns
mountPath: /host/ns/net
securityContext:
capabilities:
add:
- SYS_ADMIN
{{- end}}
volumes:
- name: config
configMap:
name: {{ template "dragonfly.dfdaemon.fullname" . }}
items:
- key: dfget-daemon.yaml
path: dfget-daemon.yaml
{{- if not .Values.dfdaemon.hostNetwork }}
- name: netns
hostPath:
path: /proc/1/ns/net
{{- end}}

View File

@ -1,42 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: {{template "dragonfly.scheduler.fullname" . }}
namespace: {{ .Values.installation.namespace }}
labels:
app: {{ template "dragonfly.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.scheduler.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .serviceAnnotations }}
annotations:
{{ toYaml .Values.scheduler.serviceAnnotations | indent 4 }}
{{- end }}
spec:
ports:
- port: {{.Values.scheduler.service.port}}
name: http
targetPort: {{ .Values.scheduler.service.targetPort }}
{{- if (and (eq .Values.scheduler.service.type "NodePort") (not (empty .Values.scheduler.service.nodePort))) }}
nodePort: {{.Values.scheduler.service.nodePort}}
{{- end }}
{{- range $index, $port := .Values.scheduler.service.extraPorts }}
- port: {{ $port.port }}
name: {{ $port.name }}
targetPort: {{ $port.port }}
{{- end }}
selector:
app: {{ template "dragonfly.scheduler.fullname" . }}
component: "{{ .Values.scheduler.name }}"
release: {{ .Release.Name }}
type: {{.Values.scheduler.service.type}}
{{if eq .Values.scheduler.service.type "LoadBalancer"}}
{{- if .Values.scheduler.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.scheduler.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
{{if .Values.scheduler.service.loadBalancerIP}}
loadBalancerIP: {{.Values.scheduler.serivice.loadBalancerIP}}
{{end}}
{{end}}

View File

@ -15,9 +15,17 @@ data:
port: {{ .Values.scheduler.containerPort }}
worker:
{{ toYaml .Values.scheduler.config.worker | indent 6 }}
cdn:
list:
- - cdn-name: {{template "dragonfly.cdn.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
ip: {{template "dragonfly.cdn.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
rpc-port: {{ .Values.cdn.service.port }}
download-port: {{ .Values.cdn.service.nginxPort }}
{{- if .Values.scheduler.config.staticCDN }}
dynconfig:
cdnDirPath: /opt/dragonfly/scheduler-cdn
{{- end}}
---
{{- if .Values.scheduler.config.staticCDN }}
apiVersion: v1
kind: ConfigMap
metadata:
name: scheduler-static-cdn
namespace: {{ .Values.installation.namespace }}
{{- end}}

View File

@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
labels:
app: {{ template "dragonfly.scheduler.fullname" . }}
@ -9,9 +9,9 @@ metadata:
release: {{ .Release.Name }}
namespace: {{ .Values.installation.namespace }}
name: {{ template "dragonfly.scheduler.fullname" . }}
{{- if .Values.scheduler.deploymentAnnotations }}
{{- if .Values.scheduler.statefulsetAnnotations }}
annotations:
{{ toYaml .Values.scheduler.deploymentAnnotations | indent 4 }}
{{ toYaml .Values.scheduler.statefulsetAnnotations | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.scheduler.replicas }}
@ -20,6 +20,7 @@ spec:
app: {{ template "dragonfly.scheduler.fullname" . }}
component: "{{ .Values.scheduler.name }}"
release: {{ .Release.Name }}
serviceName: scheduler
template:
metadata:
labels:
@ -61,6 +62,10 @@ spec:
volumeMounts:
- name: config
mountPath: "/etc/dragonfly"
{{- if .Values.scheduler.config.staticCDN }}
- name: cdn-config
mountPath: /opt/dragonfly/scheduler-cdn
{{- end}}
volumes:
- name: config
configMap:
@ -68,3 +73,8 @@ spec:
items:
- key: scheduler.yaml
path: scheduler.yaml
{{- if .Values.scheduler.config.staticCDN }}
- name: cdn-config
configMap:
name: scheduler-static-cdn
{{- end}}

View File

@ -0,0 +1,47 @@
{{- $count := .Values.scheduler.replicas | int}}
{{- range $i, $x := until $count }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "dragonfly.scheduler.fullname" $ }}-{{$i}}
namespace: {{ $.Values.installation.namespace }}
labels:
app: {{ template "dragonfly.name" $ }}
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
component: "{{ $.Values.scheduler.name }}"
heritage: {{ $.Release.Service }}
release: {{ $.Release.Name }}
{{- if $.serviceAnnotations }}
annotations:
{{ toYaml $.Values.scheduler.serviceAnnotations | indent 4 }}
{{- end }}
spec:
ports:
- port: {{$.Values.scheduler.service.port}}
name: http
targetPort: {{ $.Values.scheduler.service.targetPort }}
{{- if (and (eq $.Values.scheduler.service.type "NodePort") (not (empty $.Values.scheduler.service.nodePort))) }}
nodePort: {{$.Values.scheduler.service.nodePort}}
{{- end }}
{{- range $index, $port := $.Values.scheduler.service.extraPorts }}
- port: {{ $port.port }}
name: {{ $port.name }}
targetPort: {{ $port.port }}
{{- end }}
selector:
app: {{ template "dragonfly.scheduler.fullname" $ }}
component: "{{ $.Values.scheduler.name }}"
release: {{ $.Release.Name }}
statefulset.kubernetes.io/pod-name: {{ template "dragonfly.scheduler.fullname" $ }}-{{$i}}
type: {{$.Values.scheduler.service.type}}
{{if eq $.Values.scheduler.service.type "LoadBalancer"}}
{{- if $.Values.scheduler.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml $.Values.scheduler.service.loadBalancerSourceRanges | indent 4 }}
{{- end }}
{{if $.Values.scheduler.service.loadBalancerIP}}
loadBalancerIP: {{$.Values.scheduler.serivice.loadBalancerIP}}
{{end}}
{{end}}
---
{{- end }}

View File

@ -3,27 +3,31 @@ fullnameOverride: ""
# values for dragonfly installation
installation:
namespace: kube-system
namespace: dragonfly-system
clusterDomain: ""
scheduler:
name: scheduler
replicas: 1
nameOverride: ""
fullnameOverride: ""
replicas: 3
image: dragonflyoss/scheduler
tag: 0.1.0
tag: v0.1.0-alpha.1
pullPolicy: IfNotPresent
resources:
requests:
cpu: "512m"
memory: "512Mi"
cpu: "0"
memory: "0"
limits:
cpu: "512m"
memory: "512Mi"
cpu: "4"
memory: "8Gi"
priorityClassName: ""
nodeSelector: {}
terminationGracePeriodSeconds:
tolerations: []
podAnnotations: {}
deploymentAnnotations: {}
serviceAnnotations: {}
statefulsetAnnotations: {}
containerPort: 8002
service:
type: ClusterIP
@ -31,6 +35,7 @@ scheduler:
port: 8002
targetPort: 8002
config:
staticCDN: true
debug: false
worker:
worker-num: 1
@ -42,23 +47,24 @@ cdn:
name: cdn
nameOverride: ""
fullnameOverride: ""
replicas: 1
replicas: 3
image: dragonflyoss/cdn
tag: 0.1.0
pullPolicy: IfNotPresent
tag: v0.1.0-alpha.1
kubectlImage: bitnami/kubectl
pullPolicy: Always
resources:
requests:
cpu: "512m"
memory: "512Mi"
cpu: "0"
memory: "0"
limits:
cpu: "512m"
memory: "512Mi"
cpu: "4"
memory: "8Gi"
priorityClassName: ""
nodeSelector: {}
terminationGracePeriodSeconds:
tolerations: []
podAnnotations: {}
deploymentAnnotations: {}
statefulsetAnnotations: {}
containerPort: 8003
nginxContiainerPort: 8001
service:
@ -81,71 +87,65 @@ cdn:
storagePattern: disk
console: false
plugins:
storage:
name: disk
storageDriver:
- name: disk
enable: true
config:
baseDir: /tmp/cdn
gcConfig:
youngGCThreshold: 100G
fullGCThreshold: 5G
cleanRatio: 1
intervalThreshold: 2h
storageManager:
- name: disk
enable: true
config:
gcInitialDelay: 5s
gcInterval: 15s
driverConfigs:
disk:
gcConfig:
youngGCThreshold: 100G
fullGCThreshold: 5G
cleanRatio: 1
intervalThreshold: 2h
dfdaemon:
name: dfdaemon
nameOverride: ""
fullnameOverride: ""
image: dragonflyoss/dfdaemon
tag: 0.1.0
image: dragonflyoss/dfget
tag: v0.1.0-alpha.1
pullPolicy: IfNotPresent
resources:
requests:
cpu: "512m"
memory: "512Mi"
cpu: "0"
memory: "0"
limits:
cpu: "512m"
memory: "512Mi"
cpu: "2"
memory: "2Gi"
priorityClassName: ""
nodeSelector: {}
terminationGracePeriodSeconds:
tolerations: []
podAnnotations: {}
deploymentAnnotations: {}
daemonsetAnnotations: {}
containerPort: 65001
hostNetwork: false
config:
alive_time: 0s
gc_interval: 1m0s
pid_file: /tmp/dfdaemon.pid
lock_file: /tmp/dfdaemon.lock
data_dir: /tmp/dragonfly/dfdaemon/
work_home: /tmp/dragonfly/dfdaemon/
keep_storage: false
verbose: false
verbose: true
host:
listen_ip: 0.0.0.0
advertise_ip: 0.0.0.0
location: ""
idc: ""
security_domain: ""
net_topology: ""
download:
rate_limit: 200Mi
download_grpc:
security:
insecure: true
cacert: ""
cert: ""
key: ""
tls_config: null
unix_listen:
socket: /tmp/dfdamon.sock
peer_grpc:
security:
insecure: true
cacert: ""
cert: ""
key: ""
tcp_listen:
listen: 0.0.0.0
port: 65000
@ -153,19 +153,18 @@ dfdaemon:
rate_limit: 100Mi
security:
insecure: true
cacert: ""
cert: ""
key: ""
tcp_listen:
listen: 0.0.0.0
port: 65002
storage:
task_expire_time: 3m0s
strategy: io.d7y.storage.v2.simple
multiplex: true
proxy:
security:
insecure: true
tcp_listen:
namespace: /host/ns/net
listen: 0.0.0.0
port: 65001
registry_mirror: