dragonflyoss / Dragonfly

This repository has be archived and moved to the new repository https://github.com/dragonflyoss/Dragonfly2.
https://d7y.io
Apache License 2.0
6k stars 774 forks source link

dfdaemon fails to set registry mirror with config yaml #1536

Open yttan opened 3 years ago

yttan commented 3 years ago

Ⅰ. Issue Description

dfdaemon fails to read registry_mirror.remote from config

Ⅱ. Describe what happened

the dfdaemon config yaml in the container

bash-4.4# cat /etc/dragonfly/dfdaemon.yml

dfget_flags: ["--node","supernode:8002=1"]
proxies:
  - regx: blobs/sha256.*
  - regx: testrea
registry_mirror:
  remote: docker.abctest.com
  insecure: true

and what I saw in the dfdaemon log

2021-03-29 12:31:32.363 INFO sign:1 : using config: {"registry_mirror":{"remote":"https://index.docker.io","certs":null,"insecure":true,"direct":false},"proxies":[{"regx":"blobs/sha256.*","use_https":false,"direct":false,"redirect":""},{"regx":"testrea","use_https":false,"direct":false,"redirect":""}],"hijack_https":null,"port":65001,"hostIp":"127.0.0.1","certpem":"","keypem":"","verbose":false,"maxprocs":4,"dfget_flags":["--node","supernode:8002=1"],"supernodes":null,"ratelimit":"20MB","workHome":"/root/.small-dragonfly","localrepo":"/root/.small-dragonfly/dfdaemon/data","dfpath":"/opt/dragonfly/df-client/dfget","logConfig":{"maxSize":0,"maxBackups":0,"path":""},"localIP":"","peerPort":0,"streamMode":false}

All other fields are correct. Only registry_mirror.remote is not what I set in dfdaemon config

Ⅲ. Describe what you expected to happen

registry_mirror.remote field in the log should be docker.abctest.com as I set in the configuration file instead of https://index.docker.io

Ⅳ. How to reproduce it (as minimally and precisely as possible)

use the following yaml to create a daemonset, and see logs in container

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: dfclient
  namespace: kube-system
  labels:
    app: dfclient
spec:
  selector:
    matchLabels:
      app: dfclient
  template:
    metadata:
      labels:
        app: dfclient
    spec:
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      nodeSelector:
        dragonfly: "true"
      containers:
        - name: dfclient
          image: dragonflyoss/dfclient:1.0.2
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - name: config
              mountPath: /etc/dragonfly
          env:
            - name: HOSTNAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          ports:
            - containerPort: 65001
              name: http
      volumes:
        - name: config
          configMap:
            name: dfdaemon
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: dfdaemon
  namespace: kube-system
data:
  dfdaemon.yml: |
    dfget_flags: ["--node","supernode:8002=1"]
    proxies:
      - regx: blobs/sha256.*
    registry_mirror:
      remote: docker.testabc.com
      insecure: false

Ⅴ. Anything else we need to know?

Ⅵ. Environment: