dragonfly-stack

by Dragonfly

Helm chartv0.1.2App 2.1.49Verified publisher

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

KeyTypeDefaultDescription
dragonfly.client.config.download.concurrentPieceCountint16concurrentPieceCount is the number of concurrent pieces to download.
dragonfly.client.config.download.pieceTimeoutstring"30s"pieceTimeout is the timeout for downloading a piece from source.
dragonfly.client.config.download.rateLimitint20000000000rateLimit is the default rate limit of the download speed in bps(bytes per second), default is 20Gbps.
dragonfly.client.config.download.server.socketPathstring"/var/run/dragonfly/dfdaemon.sock"socketPath is the unix socket path for dfdaemon GRPC service.
dragonfly.client.config.dynconfig.refreshIntervalstring"5m"refreshInterval is the interval to refresh dynamic configuration from manager.
dragonfly.client.config.gc.intervalstring"900s"interval is the interval to do gc.
dragonfly.client.config.gc.policy.distHighThresholdPercentint80distHighThresholdPercent 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.distLowThresholdPercentint60distLowThresholdPercent 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.taskTTLstring"168h"taskTTL is the ttl of the task.
dragonfly.client.config.health.server.portint4003port is the port to the health server.
dragonfly.client.config.hostobject{"idc":"","location":""}host is the host configuration for dfdaemon.
dragonfly.client.config.log.levelstring"info"Specify the logging level [trace, debug, info, warn, error]
dragonfly.client.config.manager.addrslist[]addrs is manager addresses.
dragonfly.client.config.metrics.server.portint4002port is the port to the metrics server.
dragonfly.client.config.proxy.disableBackToSourceboolfalsedisableBackToSource indicates whether disable to download back-to-source when download failed.
dragonfly.client.config.proxy.prefetchboolfalseprefetch pre-downloads full of the task when download with range request.
dragonfly.client.config.proxy.readBufferSizeint32768readBufferSize is the buffer size for reading piece from disk, default is 32KB.
dragonfly.client.config.proxy.registryMirror.addrstring"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.ruleslist[{"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.portint4001port is the port to the proxy server.
dragonfly.client.config.scheduler.announceIntervalstring"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.enableBackToSourcebooltrueenableBackToSource indicates whether enable back-to-source download, when the scheduling failed.
dragonfly.client.config.scheduler.maxScheduleCountint5maxScheduleCount is the max count of schedule.
dragonfly.client.config.scheduler.scheduleTimeoutstring"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.enableboolfalseenable indicates whether enable security.
dragonfly.client.config.server.cacheDirstring"/var/cache/dragonfly/dfdaemon/"cacheDir is the directory to store cache files.
dragonfly.client.config.server.pluginDirstring"/var/lib/dragonfly/plugins/dfdaemon/"pluginDir is the directory to store plugins.
dragonfly.client.config.stats.server.portint4004port is the port to the stats server.
dragonfly.client.config.storage.dirstring"/var/lib/dragonfly/"dir is the directory to store task's metadata and content.
dragonfly.client.config.storage.keepboolfalsekeep indicates whether keep the task's metadata and content when the dfdaemon restarts.
dragonfly.client.config.storage.readBufferSizeint131072readBufferSize is the buffer size for reading piece from disk, default is 128KB.
dragonfly.client.config.storage.writeBufferSizeint131072writeBufferSize is the buffer size for writing piece to disk, default is 128KB.
dragonfly.client.config.upload.rateLimitint20000000000rateLimit is the default rate limit of the upload speed in bps(bytes per second), default is 20Gbps.
dragonfly.client.config.upload.server.portint4000port is the port to the grpc server.
dragonfly.client.config.verboseboolfalseverbose prints log.
dragonfly.client.dfinit.config.containerRuntime.containerd.configPathstring"/etc/containerd/config.toml"configPath is the path of containerd configuration file.
dragonfly.client.dfinit.config.containerRuntime.containerd.registrieslist[{"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.levelstring"info"Specify the logging level [trace, debug, info, warn, error]
dragonfly.client.dfinit.config.proxy.addrstring"http://127.0.0.1:4001"addr is the proxy server address of dfdaemon.
dragonfly.client.dfinit.config.verbosebooltrueverbose prints log.
dragonfly.client.dfinit.enableboolfalseEnable dfinit to override configuration of container runtime.
dragonfly.client.dfinit.image.digeststring""Image digest.
dragonfly.client.dfinit.image.pullPolicystring"IfNotPresent"Image pull policy.
dragonfly.client.dfinit.image.registrystring"docker.io"Image registry.
dragonfly.client.dfinit.image.repositorystring"dragonflyoss/dfinit"Image repository.
dragonfly.client.dfinit.image.tagstring"v0.1.82"Image tag.
dragonfly.client.enablebooltrueEnable client.
dragonfly.client.extraVolumeMountslist[{"mountPath":"/var/lib/dragonfly/","name":"storage"},{"mountPath":"/var/log/dragonfly/dfdaemon/","name":"logs"}]Extra volumeMounts for dfdaemon.
dragonfly.client.extraVolumeslist[{"hostPath":{"path":"/var/lib/dragonfly/","type":"DirectoryOrCreate"},"name":"storage"},{"emptyDir":{},"name":"logs"}]Extra volumes for dfdaemon.
dragonfly.client.fullnameOverridestring""Override scheduler fullname.
dragonfly.client.hostAliaseslist[]Host Aliases.
dragonfly.client.hostIPCbooltruehostIPC specify if host IPC should be enabled for peer pod.
dragonfly.client.hostNetworkbooltruehostNetwork specify if host network should be enabled for peer pod.
dragonfly.client.hostPIDbooltruehostPID allows visibility of processes on the host for peer pod.
dragonfly.client.image.digeststring""Image digest.
dragonfly.client.image.pullPolicystring"IfNotPresent"Image pull policy.
dragonfly.client.image.pullSecretslist[] (defaults to global.imagePullSecrets).Image pull secrets.
dragonfly.client.image.registrystring"docker.io"Image registry.
dragonfly.client.image.repositorystring"dragonflyoss/client"Image repository.
dragonfly.client.image.tagstring"v0.1.82"Image tag.
dragonfly.client.initContainer.image.digeststring""Image digest.
dragonfly.client.initContainer.image.pullPolicystring"IfNotPresent"Image pull policy.
dragonfly.client.initContainer.image.registrystring"docker.io"Image registry.
dragonfly.client.initContainer.image.repositorystring"busybox"Image repository.
dragonfly.client.initContainer.image.tagstring"latest"Image tag.
dragonfly.client.maxProcsstring""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.enableboolfalseEnable 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdragonfly-stack is pinned at v0.1.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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