dragonfly-stack
by Dragonfly
Collects Dragonfly component and Nydus component into a single chart to provide a complete solution for the Dragonfly stack.
About this chart
Dragonfly Stack Helm Chart
Collects Dragonfly component and Nydus component into a single chart to provide a complete solution for the Dragonfly stack.
TL;DR
helm repo add dragonfly-stack https://dragonflyoss.github.io/helm-charts/
helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly-stask
Introduction
Dragonfly is an open source intelligent P2P based image and file distribution system. Its goal is to tackle all distribution problems in cloud native scenarios. Currently Dragonfly focuses on being:
- Simple: well-defined user-facing API (HTTP), non-invasive to all container engines;
- Efficient: Seed peer support, P2P based file distribution to save enterprise bandwidth;
- Intelligent: host level speed limit, intelligent flow control due to host detection;
- Secure: block transmission encryption, HTTPS connection support.
Dragonfly is now hosted by the Cloud Native Computing Foundation (CNCF) as an Incubating Level Project. Originally it was born to solve all kinds of distribution at very large scales, such as application distribution, cache distribution, log distribution, image distribution, and so on.
Prerequisites
- Kubernetes cluster 1.20+
- Helm v3.8.0+
Installation Guide
When use Dragonfly in Kubernetes, a container runtime must be configured. These work can be done by init script in this charts.
For more detail about installation is available in Kubernetes with Dragonfly
We recommend read the details about Kubernetes with Dragonfly before install.
We did not recommend to using dragonfly with docker in Kubernetes due to many reasons: 1. no fallback image pulling policy. 2. deprecated in Kubernetes.
Installation
Install with custom configuration
Create the values.yaml configuration file. It is recommended to use external redis and mysql instead of containers. This example uses external mysql and redis.
dragonfly:
mysql:
enable: false
externalMysql:
migrate: true
host: mysql-host
username: dragonfly
password: dragonfly
database: manager
port: 3306
redis:
enable: false
externalRedis:
addrs:
- redis.example.com:6379
password: dragonfly
Install dragonfly-stack chart with release name dragonfly:
helm repo add dragonfly-stack https://dragonflyoss.github.io/helm-charts/
helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly-stack -f values.yaml
Install with an existing manager
Create the values.yaml configuration file. Need to configure the cluster id associated with scheduler and seed peer. This example is to deploy a cluster using the existing manager and redis.
dragonfly:
scheduler:
config:
manager:
schedulerClusterID: 1
seedClient:
config:
seedPeer:
enable: true
type: super
clusterID: 1
manager:
enable: false
externalManager:
enable: true
host: "dragonfly-manager.dragonfly-system.svc.cluster.local"
restPort: 8080
grpcPort: 65003
redis:
enable: false
externalRedis:
addrs:
- redis.example.com:6379
password: dragonfly
mysql:
enable: false
Install dragonfly-stack chart with release name dragonfly:
helm repo add dragonfly-stack https://dragonflyoss.github.io/helm-charts/
helm install --create-namespace --namespace dragonfly-system dragonfly dragonfly/dragonfly-stack -f values.yaml
Uninstall
Uninstall the dragonfly deployment:
helm delete dragonfly --namespace dragonfly-system
Values
| Key | Type | Default | Description |
|---|---|---|---|
| dragonfly.client.config.download.concurrentPieceCount | int | 16 | concurrentPieceCount is the number of concurrent pieces to download. |
| dragonfly.client.config.download.pieceTimeout | string | "30s" | pieceTimeout is the timeout for downloading a piece from source. |
| dragonfly.client.config.download.rateLimit | int | 20000000000 | rateLimit is the default rate limit of the download speed in bps(bytes per second), default is 20Gbps. |
| dragonfly.client.config.download.server.socketPath | string | "/var/run/dragonfly/dfdaemon.sock" | socketPath is the unix socket path for dfdaemon GRPC service. |
| dragonfly.client.config.dynconfig.refreshInterval | string | "5m" | refreshInterval is the interval to refresh dynamic configuration from manager. |
| dragonfly.client.config.gc.interval | string | "900s" | interval is the interval to do gc. |
| dragonfly.client.config.gc.policy.distHighThresholdPercent | int | 80 | distHighThresholdPercent is the high threshold percent of the disk usage. If the disk usage is greater than the threshold, dfdaemon will do gc. |
| dragonfly.client.config.gc.policy.distLowThresholdPercent | int | 60 | distLowThresholdPercent is the low threshold percent of the disk usage. If the disk usage is less than the threshold, dfdaemon will stop gc. |
| dragonfly.client.config.gc.policy.taskTTL | string | "168h" | taskTTL is the ttl of the task. |
| dragonfly.client.config.health.server.port | int | 4003 | port is the port to the health server. |
| dragonfly.client.config.host | object | {"idc":"","location":""} | host is the host configuration for dfdaemon. |
| dragonfly.client.config.log.level | string | "info" | Specify the logging level [trace, debug, info, warn, error] |
| dragonfly.client.config.manager.addrs | list | [] | addrs is manager addresses. |
| dragonfly.client.config.metrics.server.port | int | 4002 | port is the port to the metrics server. |
| dragonfly.client.config.proxy.disableBackToSource | bool | false | disableBackToSource indicates whether disable to download back-to-source when download failed. |
| dragonfly.client.config.proxy.prefetch | bool | false | prefetch pre-downloads full of the task when download with range request. |
| dragonfly.client.config.proxy.readBufferSize | int | 32768 | readBufferSize is the buffer size for reading piece from disk, default is 32KB. |
| dragonfly.client.config.proxy.registryMirror.addr | string | "https://index.docker.io" | addr is the default address of the registry mirror. Proxy will start a registry mirror service for the client to pull the image. The client can use the default address of the registry mirror in configuration to pull the image. The X-Dragonfly-Registry header can instead of the default address of registry mirror. |
| dragonfly.client.config.proxy.rules | list | [{"regex":"blobs/sha256.*"}] | rules is the list of rules for the proxy server. regex is the regex of the request url. useTLS indicates whether use tls for the proxy backend. redirect is the redirect url. filteredQueryParams is the filtered query params to generate the task id. When filter is ["Signature", "Expires", "ns"], for example: http://example.com/xyz?Expires=e1&Signature=s1&ns=docker.io and http://example.com/xyz?Expires=e2&Signature=s2&ns=docker.io will generate the same task id. Default value includes the filtered query params of s3, gcs, oss, obs, cos. |
| dragonfly.client.config.proxy.server.port | int | 4001 | port is the port to the proxy server. |
| dragonfly.client.config.scheduler.announceInterval | string | "5m" | announceInterval is the interval to announce peer to the scheduler. Announcer will provide the scheduler with peer information for scheduling, peer information includes cpu, memory, etc. |
| dragonfly.client.config.scheduler.enableBackToSource | bool | true | enableBackToSource indicates whether enable back-to-source download, when the scheduling failed. |
| dragonfly.client.config.scheduler.maxScheduleCount | int | 5 | maxScheduleCount is the max count of schedule. |
| dragonfly.client.config.scheduler.scheduleTimeout | string | "30s" | scheduleTimeout is the timeout for scheduling. If the scheduling timesout, dfdaemon will back-to-source download if enableBackToSource is true, otherwise dfdaemon will return download failed. |
| dragonfly.client.config.security.enable | bool | false | enable indicates whether enable security. |
| dragonfly.client.config.server.cacheDir | string | "/var/cache/dragonfly/dfdaemon/" | cacheDir is the directory to store cache files. |
| dragonfly.client.config.server.pluginDir | string | "/var/lib/dragonfly/plugins/dfdaemon/" | pluginDir is the directory to store plugins. |
| dragonfly.client.config.stats.server.port | int | 4004 | port is the port to the stats server. |
| dragonfly.client.config.storage.dir | string | "/var/lib/dragonfly/" | dir is the directory to store task's metadata and content. |
| dragonfly.client.config.storage.keep | bool | false | keep indicates whether keep the task's metadata and content when the dfdaemon restarts. |
| dragonfly.client.config.storage.readBufferSize | int | 131072 | readBufferSize is the buffer size for reading piece from disk, default is 128KB. |
| dragonfly.client.config.storage.writeBufferSize | int | 131072 | writeBufferSize is the buffer size for writing piece to disk, default is 128KB. |
| dragonfly.client.config.upload.rateLimit | int | 20000000000 | rateLimit is the default rate limit of the upload speed in bps(bytes per second), default is 20Gbps. |
| dragonfly.client.config.upload.server.port | int | 4000 | port is the port to the grpc server. |
| dragonfly.client.config.verbose | bool | false | verbose prints log. |
| dragonfly.client.dfinit.config.containerRuntime.containerd.configPath | string | "/etc/containerd/config.toml" | configPath is the path of containerd configuration file. |
| dragonfly.client.dfinit.config.containerRuntime.containerd.registries | list | [{"capabilities":["pull","resolve"],"hostNamespace":"docker.io","serverAddr":"https://index.docker.io"},{"capabilities":["pull","resolve"],"hostNamespace":"ghcr.io","serverAddr":"https://ghcr.io"}] | registries is the list of containerd registries. hostNamespace is the location where container images and artifacts are sourced, refer to https://github.com/containerd/containerd/blob/main/docs/hosts.md#registry-host-namespace. The registry host namespace portion is [registry_host_name |
| dragonfly.client.dfinit.config.log.level | string | "info" | Specify the logging level [trace, debug, info, warn, error] |
| dragonfly.client.dfinit.config.proxy.addr | string | "http://127.0.0.1:4001" | addr is the proxy server address of dfdaemon. |
| dragonfly.client.dfinit.config.verbose | bool | true | verbose prints log. |
| dragonfly.client.dfinit.enable | bool | false | Enable dfinit to override configuration of container runtime. |
| dragonfly.client.dfinit.image.digest | string | "" | Image digest. |
| dragonfly.client.dfinit.image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| dragonfly.client.dfinit.image.registry | string | "docker.io" | Image registry. |
| dragonfly.client.dfinit.image.repository | string | "dragonflyoss/dfinit" | Image repository. |
| dragonfly.client.dfinit.image.tag | string | "v0.1.82" | Image tag. |
| dragonfly.client.enable | bool | true | Enable client. |
| dragonfly.client.extraVolumeMounts | list | [{"mountPath":"/var/lib/dragonfly/","name":"storage"},{"mountPath":"/var/log/dragonfly/dfdaemon/","name":"logs"}] | Extra volumeMounts for dfdaemon. |
| dragonfly.client.extraVolumes | list | [{"hostPath":{"path":"/var/lib/dragonfly/","type":"DirectoryOrCreate"},"name":"storage"},{"emptyDir":{},"name":"logs"}] | Extra volumes for dfdaemon. |
| dragonfly.client.fullnameOverride | string | "" | Override scheduler fullname. |
| dragonfly.client.hostAliases | list | [] | Host Aliases. |
| dragonfly.client.hostIPC | bool | true | hostIPC specify if host IPC should be enabled for peer pod. |
| dragonfly.client.hostNetwork | bool | true | hostNetwork specify if host network should be enabled for peer pod. |
| dragonfly.client.hostPID | bool | true | hostPID allows visibility of processes on the host for peer pod. |
| dragonfly.client.image.digest | string | "" | Image digest. |
| dragonfly.client.image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| dragonfly.client.image.pullSecrets | list | [] (defaults to global.imagePullSecrets). | Image pull secrets. |
| dragonfly.client.image.registry | string | "docker.io" | Image registry. |
| dragonfly.client.image.repository | string | "dragonflyoss/client" | Image repository. |
| dragonfly.client.image.tag | string | "v0.1.82" | Image tag. |
| dragonfly.client.initContainer.image.digest | string | "" | Image digest. |
| dragonfly.client.initContainer.image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| dragonfly.client.initContainer.image.registry | string | "docker.io" | Image registry. |
| dragonfly.client.initContainer.image.repository | string | "busybox" | Image repository. |
| dragonfly.client.initContainer.image.tag | string | "latest" | Image tag. |
| dragonfly.client.maxProcs | string | "" | maxProcs Limits the number of operating system threads that can execute user-level. Go code simultaneously by setting GOMAXPROCS environment variable, refer to https://golang.org/pkg/runtime. |
| dragonfly.client.metrics.enable | bool | false | Enable client metrics. |
Deploy dragonfly-stack with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dragonfly-stack on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartdragonfly-stack is pinned at v0.1.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply