diff --git a/deploy/kubernetes/.gitkeep b/deploy/kubernetes/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/cdn.yaml b/deploy/kustomize/single-cluster-native/bases/cdn/cdn.yaml new file mode 100644 index 00000000000..c4da861232f --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/cdn.yaml @@ -0,0 +1,72 @@ +# This file is the template of cdn system configuration file. +# You can configure your cdn system by change the parameter according your requirement. +--- +base: + # listenPort is the port cdn server listens on. + # default: 8003 + listenPort: 8003 + + # DownloadPort is the port for download files from cdn. + # And you should start a file server firstly which listens on the download port. + # default: 8001 + downloadPort: 8001 + + # SystemReservedBandwidth is the network bandwidth reserved for system software. + # default: 20 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. + systemReservedBandwidth: 20M + + # MaxBandwidth is the network bandwidth that cdn can use. + # default: 200 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. + maxBandwidth: 1024M + + # Whether to enable profiler + # default: false + enableProfiler: false + + # FailAccessInterval is the interval time after failed to access the URL. + # If a task failed to be downloaded from the source, it will not be retried in the time since the last failure. + # default: 3m + failAccessInterval: 3m + + # GCInitialDelay is the delay time from the start to the first GC execution. + # default: 6s + gcInitialDelay: 6s + + # GCMetaInterval is the interval time to execute GC meta. + # default: 2m0s + gcMetaInterval: 2m + + # gcStorageInterval is the interval time to execute GC storage. + # default: 15s + gcStorageInterval: 15s + + # TaskExpireTime when a task is not accessed within the taskExpireTime, + # and it will be treated to be expired. + # default: 3m0s + taskExpireTime: 3m + + # StoragePattern is the pattern of storage policy, [disk/hybrid] + storagePattern: disk + + # Console shows log on console + console: false + +plugins: + storageDriver: + - name: disk + enable: true + config: + baseDir: /tmp/cdn + storageManager: + - name: disk + enable: true + config: + gcInitialDelay: 5s + gcInterval: 15s + driverConfigs: + disk: + gcConfig: + youngGCThreshold: 100G + fullGCThreshold: 5G + cleanRatio: 1 + intervalThreshold: 2h diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/nginx.conf b/deploy/kustomize/single-cluster-native/bases/cdn/nginx.conf new file mode 100644 index 00000000000..26e672f1240 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/nginx.conf @@ -0,0 +1,51 @@ +worker_rlimit_nofile 100000; + +events { + use epoll; + worker_connections 20480; +} + +http { + include mime.types; + default_type application/octet-stream; + root /home/admin/cai/htdocs; + sendfile on; + tcp_nopush on; + + server_tokens off; + keepalive_timeout 5; + + client_header_timeout 1m; + send_timeout 1m; + client_max_body_size 3m; + + index index.html index.htm; + access_log off; + log_not_found off; + + gzip on; + gzip_http_version 1.0; + gzip_comp_level 6; + gzip_min_length 1024; + gzip_proxied any; + gzip_vary on; + gzip_disable msie6; + gzip_buffers 96 8k; + gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml application/json; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Web-Server-Type nginx; + proxy_set_header WL-Proxy-Client-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_redirect off; + proxy_buffers 128 8k; + proxy_intercept_errors on; + + server { + listen 8001; + location / { + root /tmp/cdn; + } + } +} diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/rabc.yaml b/deploy/kustomize/single-cluster-native/bases/cdn/rabc.yaml new file mode 100644 index 00000000000..42fff4c5307 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/rabc.yaml @@ -0,0 +1,29 @@ +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: cdn-role +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - update + - patch + +--- + +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: cdn-role-binding +roleRef: + kind: Role + name: cdn-role + apiGroup: rbac.authorization.k8s.io +subjects: +- kind: ServiceAccount + name: cdn diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/service.yaml b/deploy/kustomize/single-cluster-native/bases/cdn/service.yaml new file mode 100644 index 00000000000..1c3756eedf3 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: cdn +spec: + selector: + app: dragonfly + component: cdn + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8003 + protocol: TCP + targetPort: 8003 + - name: http + port: 8001 + protocol: TCP + targetPort: 8001 \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/serviceaccount.yaml b/deploy/kustomize/single-cluster-native/bases/cdn/serviceaccount.yaml new file mode 100644 index 00000000000..278d2e89e48 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/serviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: cdn diff --git a/deploy/kustomize/single-cluster-native/bases/cdn/statefulset.yaml b/deploy/kustomize/single-cluster-native/bases/cdn/statefulset.yaml new file mode 100644 index 00000000000..7ace5802b50 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/cdn/statefulset.yaml @@ -0,0 +1,87 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: cdn + labels: + app: dragonfly + component: cdn +spec: + selector: + matchLabels: + app: dragonfly + component: cdn + replicas: 1 + serviceName: cdn + template: + metadata: + labels: + app: dragonfly + component: cdn + spec: + serviceAccountName: cdn + initContainers: + - name: update-configmap + image: bitnami/kubectl + command: + - /bin/bash + - -xc + - | + HOSTNAME=$(cat /etc/hostname) + cat < /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" + containers: + - name: cdn + command: + - /bin/sh + - -c + - | + cp /etc/dragonfly/nginx.conf /etc/nginx/nginx.conf + nginx + exec /opt/dragonfly/df-cdn/cdn + image: dragonflyoss/cdn + imagePullPolicy: "Always" + ports: + - containerPort: 8001 + - containerPort: 8003 + volumeMounts: + - name: config + mountPath: /etc/dragonfly + volumes: + - name: config + configMap: + name: cdn diff --git a/deploy/kustomize/single-cluster-native/bases/dfdaemon/daemonset.yaml b/deploy/kustomize/single-cluster-native/bases/dfdaemon/daemonset.yaml new file mode 100644 index 00000000000..424a16e7aef --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/dfdaemon/daemonset.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: dfdaemon + labels: + app: dragonfly + component: dfdaemon +spec: + selector: + matchLabels: + app: dragonfly + component: dfdaemon + updateStrategy: + rollingUpdate: + maxUnavailable: 10 + type: RollingUpdate + template: + metadata: + labels: + app: dragonfly + component: dfdaemon + spec: + serviceAccountName: dfdaemon + containers: + - name: dfdaemon + image: dragonflyoss/dfget + imagePullPolicy: "Always" + volumeMounts: + - name: config + mountPath: /etc/dragonfly + - name: netns # the mountPath is setting in proxy.tcp_listen.namespace + mountPath: /host/ns/net + ports: # 65001 is in host network, no need here + - containerPort: 65000 + - containerPort: 65002 + securityContext: + capabilities: + add: + - SYS_ADMIN # setns need CAP_SYS_ADMIN capability + volumes: + - name: config + configMap: + name: dfdaemon + - name: netns + hostPath: + path: /proc/1/ns/net # bind mount host net ns to pod, dfdaemon can listen 65001 in host network \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/bases/dfdaemon/dfget.yaml b/deploy/kustomize/single-cluster-native/bases/dfdaemon/dfget.yaml new file mode 100644 index 00000000000..5f9c30027b4 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/dfdaemon/dfget.yaml @@ -0,0 +1,145 @@ +# daemon alive time, when sets 0s, daemon will not auto exit +alive_time: 0s + +# daemon gc task running interval +gc_interval: 1m0s + +# when daemon exit, keep peer task data or not +# it is usefully when upgrade daemon service, all local cache will be saved +keep_storage: true + +# all addresses of all schedulers +# the schedulers of all daemons should be same in one region or zone. +# daemon will send tasks to a fixed scheduler by hashing the task url and meta data +# caution: only tcp is supported +scheduler: + # below example is a stand address + net_addrs: + - type: tcp + addr: scheduler-0.dragonfly.svc:8002 + - type: tcp + addr: scheduler-1.dragonfly.svc:8002 + - type: tcp + addr: scheduler-2.dragonfly.svc:8002 + # schedule timeout + schedule_timeout: 10s + +# when enable, pprof will be enabled, +verbose: true +console: false + +# current host info used for scheduler +host: + # tcp service listen address + # port should be set by other options + listen_ip: 0.0.0.0 + # access ip for other peers + # when local ip is different with access ip, advertise_ip should be set + advertise_ip: 0.0.0.0 + # geographical location and network topology + location: "" + idc: "" + security_domain: "" + net_topology: "" + +# download service option +download: + # download limit per second + total_rate_limit: 1024Mi + per_peer_rate_limit: 1024Mi + # download grpc option + download_grpc: + # security option + security: + insecure: true + cacert: "" + cert: "" + key: "" + tls_config: null + # download service listen address + # current, only support unix domain socket + unix_listen: + socket: /var/run/dfdaemon.sock + # peer grpc option + # peer grpc service send pieces info to other peers + peer_grpc: + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65000 + # if want to limit upper port, please use blow format +# port: +# start: 65000 +# end: 65009 + +# proxy config file location or detail config +# proxy: "" + +# upload service option +upload: + # upload limit per second + rate_limit: 200Mi + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65002 + # if want to limit upper port, please use blow format +# port: +# start: 65020 +# end: 65029 + +# peer task storage option +storage: + # task data expire time + # when there is no access to a task data, this task will be gc. + task_expire_time: 3m0s + multiplex: true + +# proxy service option +proxy: + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # Namespace stands the linux net namespace, like /proc/1/ns/net + # It's useful for running daemon in pod with ip allocated and listen in host + # Linux only + namespace: /host/ns/net + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65001 + # if want to limit upper port, please use blow format + # port: + # start: 65020 + # end: 65029 + registry_mirror: + # url for the registry mirror + url: https://index.docker.io + # whether to ignore https certificate errors + insecure: true + # optional certificates if the remote server uses self-signed certificates + certs: [ ] + # whether to request the remote registry directly + direct: false + + proxies: + # proxy all http image layer download requests with dfget + - regx: (blobs|manifests|config)/sha256.* diff --git a/deploy/kustomize/single-cluster-native/bases/dfdaemon/seviceaccount.yaml b/deploy/kustomize/single-cluster-native/bases/dfdaemon/seviceaccount.yaml new file mode 100644 index 00000000000..c0aaed28919 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/dfdaemon/seviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: dfdaemon diff --git a/deploy/kustomize/single-cluster-native/bases/kustomization.yaml b/deploy/kustomize/single-cluster-native/bases/kustomization.yaml new file mode 100644 index 00000000000..0ef5712fc5a --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/kustomization.yaml @@ -0,0 +1,36 @@ +namespace: dragonfly +resources: +- namespace.yaml +- cdn/rabc.yaml +- cdn/service.yaml +- cdn/serviceaccount.yaml +- cdn/statefulset.yaml +- dfdaemon/seviceaccount.yaml +- dfdaemon/daemonset.yaml +- scheduler/configmap.yaml +- scheduler/service.yaml +- scheduler/statefulset.yaml +generatorOptions: + disableNameSuffixHash: true + labels: + kustomize.resource.generated.by: dragonfly +configMapGenerator: +- name: dfdaemon + files: + - dfdaemon/dfget.yaml +- name: scheduler + files: + - scheduler/scheduler.yaml +- name: cdn + files: + - cdn/nginx.conf + - cdn/cdn.yaml +images: +- name: dragonflyoss/cdn + newTag: latest +- name: dragonflyoss/dfget + newTag: latest +- name: dragonflyoss/scheduler + newTag: latest +- name: bitnami/kubectl + newTag: latest \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/bases/namespace.yaml b/deploy/kustomize/single-cluster-native/bases/namespace.yaml new file mode 100644 index 00000000000..5763fa04184 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: dragonfly \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/bases/scheduler/configmap.yaml b/deploy/kustomize/single-cluster-native/bases/scheduler/configmap.yaml new file mode 100644 index 00000000000..060f6d01653 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/scheduler/configmap.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: scheduler-static-cdn \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/bases/scheduler/scheduler.yaml b/deploy/kustomize/single-cluster-native/bases/scheduler/scheduler.yaml new file mode 100644 index 00000000000..08bc1a299f5 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/scheduler/scheduler.yaml @@ -0,0 +1,13 @@ +verbose: true + +server: + port: 8002 + +worker: + workerNum: 4 + workerJobPoolSize: 10000 + senderNum: 10 + senderJobPoolSize: 10000 + +dynconfig: + cdnDirPath: /opt/dragonfly/scheduler-cdn diff --git a/deploy/kustomize/single-cluster-native/bases/scheduler/service.yaml b/deploy/kustomize/single-cluster-native/bases/scheduler/service.yaml new file mode 100644 index 00000000000..af33776b314 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/scheduler/service.yaml @@ -0,0 +1,72 @@ +apiVersion: v1 +kind: Service +metadata: + name: scheduler +spec: + selector: + app: dragonfly + component: scheduler + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-0 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-0 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-1 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-1 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-2 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-2 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 diff --git a/deploy/kustomize/single-cluster-native/bases/scheduler/statefulset.yaml b/deploy/kustomize/single-cluster-native/bases/scheduler/statefulset.yaml new file mode 100644 index 00000000000..4236063e3c5 --- /dev/null +++ b/deploy/kustomize/single-cluster-native/bases/scheduler/statefulset.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: scheduler + labels: + app: dragonfly + component: scheduler +spec: + serviceName: scheduler + selector: + matchLabels: + app: dragonfly + component: scheduler + replicas: 3 + template: + metadata: + labels: + app: dragonfly + component: scheduler + spec: + containers: + - name: scheduler + image: dragonflyoss/scheduler + imagePullPolicy: "Always" + ports: + - containerPort: 8002 + volumeMounts: + - name: config + mountPath: /etc/dragonfly + - name: cdn-config + mountPath: /opt/dragonfly/scheduler-cdn + volumes: + - name: config + configMap: + name: scheduler + - name: cdn-config + configMap: + name: scheduler-static-cdn \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-native/overlays/sample/kustomization.yaml b/deploy/kustomize/single-cluster-native/overlays/sample/kustomization.yaml new file mode 100644 index 00000000000..0fa40282b7f --- /dev/null +++ b/deploy/kustomize/single-cluster-native/overlays/sample/kustomization.yaml @@ -0,0 +1,12 @@ +resources: +- ../../bases +images: +- name: dragonflyoss/cdn + newName: sample.com/d7y/cdn + newTag: latest +- name: dragonflyoss/dfget + newName: sample.com/d7y/dfget + newTag: latest +- name: dragonflyoss/scheduler + newName: sample.com/d7y/scheduler + newTag: latest diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/cdn.yaml b/deploy/kustomize/single-cluster-openkruise/bases/cdn/cdn.yaml new file mode 100644 index 00000000000..c4da861232f --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/cdn.yaml @@ -0,0 +1,72 @@ +# This file is the template of cdn system configuration file. +# You can configure your cdn system by change the parameter according your requirement. +--- +base: + # listenPort is the port cdn server listens on. + # default: 8003 + listenPort: 8003 + + # DownloadPort is the port for download files from cdn. + # And you should start a file server firstly which listens on the download port. + # default: 8001 + downloadPort: 8001 + + # SystemReservedBandwidth is the network bandwidth reserved for system software. + # default: 20 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. + systemReservedBandwidth: 20M + + # MaxBandwidth is the network bandwidth that cdn can use. + # default: 200 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. + maxBandwidth: 1024M + + # Whether to enable profiler + # default: false + enableProfiler: false + + # FailAccessInterval is the interval time after failed to access the URL. + # If a task failed to be downloaded from the source, it will not be retried in the time since the last failure. + # default: 3m + failAccessInterval: 3m + + # GCInitialDelay is the delay time from the start to the first GC execution. + # default: 6s + gcInitialDelay: 6s + + # GCMetaInterval is the interval time to execute GC meta. + # default: 2m0s + gcMetaInterval: 2m + + # gcStorageInterval is the interval time to execute GC storage. + # default: 15s + gcStorageInterval: 15s + + # TaskExpireTime when a task is not accessed within the taskExpireTime, + # and it will be treated to be expired. + # default: 3m0s + taskExpireTime: 3m + + # StoragePattern is the pattern of storage policy, [disk/hybrid] + storagePattern: disk + + # Console shows log on console + console: false + +plugins: + storageDriver: + - name: disk + enable: true + config: + baseDir: /tmp/cdn + storageManager: + - name: disk + enable: true + config: + gcInitialDelay: 5s + gcInterval: 15s + driverConfigs: + disk: + gcConfig: + youngGCThreshold: 100G + fullGCThreshold: 5G + cleanRatio: 1 + intervalThreshold: 2h diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/nginx.conf b/deploy/kustomize/single-cluster-openkruise/bases/cdn/nginx.conf new file mode 100644 index 00000000000..26e672f1240 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/nginx.conf @@ -0,0 +1,51 @@ +worker_rlimit_nofile 100000; + +events { + use epoll; + worker_connections 20480; +} + +http { + include mime.types; + default_type application/octet-stream; + root /home/admin/cai/htdocs; + sendfile on; + tcp_nopush on; + + server_tokens off; + keepalive_timeout 5; + + client_header_timeout 1m; + send_timeout 1m; + client_max_body_size 3m; + + index index.html index.htm; + access_log off; + log_not_found off; + + gzip on; + gzip_http_version 1.0; + gzip_comp_level 6; + gzip_min_length 1024; + gzip_proxied any; + gzip_vary on; + gzip_disable msie6; + gzip_buffers 96 8k; + gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml application/json; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Web-Server-Type nginx; + proxy_set_header WL-Proxy-Client-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_redirect off; + proxy_buffers 128 8k; + proxy_intercept_errors on; + + server { + listen 8001; + location / { + root /tmp/cdn; + } + } +} diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/rabc.yaml b/deploy/kustomize/single-cluster-openkruise/bases/cdn/rabc.yaml new file mode 100644 index 00000000000..42fff4c5307 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/rabc.yaml @@ -0,0 +1,29 @@ +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: cdn-role +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - update + - patch + +--- + +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: cdn-role-binding +roleRef: + kind: Role + name: cdn-role + apiGroup: rbac.authorization.k8s.io +subjects: +- kind: ServiceAccount + name: cdn diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/service.yaml b/deploy/kustomize/single-cluster-openkruise/bases/cdn/service.yaml new file mode 100644 index 00000000000..1c3756eedf3 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: cdn +spec: + selector: + app: dragonfly + component: cdn + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8003 + protocol: TCP + targetPort: 8003 + - name: http + port: 8001 + protocol: TCP + targetPort: 8001 \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/serviceaccount.yaml b/deploy/kustomize/single-cluster-openkruise/bases/cdn/serviceaccount.yaml new file mode 100644 index 00000000000..278d2e89e48 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/serviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: cdn diff --git a/deploy/kustomize/single-cluster-openkruise/bases/cdn/statefulset.yaml b/deploy/kustomize/single-cluster-openkruise/bases/cdn/statefulset.yaml new file mode 100644 index 00000000000..b0f8592d0dd --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/cdn/statefulset.yaml @@ -0,0 +1,89 @@ +# uncomment the follow line, if your k8s is not with openkruise +#apiVersion: apps/v1 +apiVersion: apps.kruise.io/v1alpha1 +kind: StatefulSet +metadata: + name: cdn + labels: + app: dragonfly + component: cdn +spec: + selector: + matchLabels: + app: dragonfly + component: cdn + replicas: 3 + serviceName: cdn + template: + metadata: + labels: + app: dragonfly + component: cdn + spec: + serviceAccountName: cdn + initContainers: + - name: update-configmap + image: bitnami/kubectl + command: + - /bin/bash + - -xc + - | + HOSTNAME=$(cat /etc/hostname) + cat < /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" + containers: + - name: cdn + command: + - /bin/sh + - -c + - | + cp /etc/dragonfly/nginx.conf /etc/nginx/nginx.conf + nginx + exec /opt/dragonfly/df-cdn/cdn + image: dragonflyoss/cdn + imagePullPolicy: "Always" + ports: + - containerPort: 8001 + - containerPort: 8003 + volumeMounts: + - name: config + mountPath: /etc/dragonfly + volumes: + - name: config + configMap: + name: cdn diff --git a/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/daemonset.yaml b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/daemonset.yaml new file mode 100644 index 00000000000..e9fb1de51ff --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/daemonset.yaml @@ -0,0 +1,48 @@ +# uncomment the follow line, if your k8s is not with openkruise +#apiVersion: apps/v1 +apiVersion: apps.kruise.io/v1alpha1 +kind: DaemonSet +metadata: + name: dfdaemon + labels: + app: dragonfly + component: dfdaemon +spec: + selector: + matchLabels: + app: dragonfly + component: dfdaemon + updateStrategy: + rollingUpdate: + maxUnavailable: 10 + type: RollingUpdate + template: + metadata: + labels: + app: dragonfly + component: dfdaemon + spec: + serviceAccountName: dfdaemon + containers: + - name: dfdaemon + image: dragonflyoss/dfget + imagePullPolicy: "Always" + volumeMounts: + - name: config + mountPath: /etc/dragonfly + - name: netns # the mountPath is setting in proxy.tcp_listen.namespace + mountPath: /host/ns/net + ports: # 65001 is in host network, no need here + - containerPort: 65000 + - containerPort: 65002 + securityContext: + capabilities: + add: + - SYS_ADMIN # setns need CAP_SYS_ADMIN capability + volumes: + - name: config + configMap: + name: dfdaemon + - name: netns + hostPath: + path: /proc/1/ns/net # bind mount host net ns to pod, dfdaemon can listen 65001 in host network \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/dfget.yaml b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/dfget.yaml new file mode 100644 index 00000000000..5f9c30027b4 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/dfget.yaml @@ -0,0 +1,145 @@ +# daemon alive time, when sets 0s, daemon will not auto exit +alive_time: 0s + +# daemon gc task running interval +gc_interval: 1m0s + +# when daemon exit, keep peer task data or not +# it is usefully when upgrade daemon service, all local cache will be saved +keep_storage: true + +# all addresses of all schedulers +# the schedulers of all daemons should be same in one region or zone. +# daemon will send tasks to a fixed scheduler by hashing the task url and meta data +# caution: only tcp is supported +scheduler: + # below example is a stand address + net_addrs: + - type: tcp + addr: scheduler-0.dragonfly.svc:8002 + - type: tcp + addr: scheduler-1.dragonfly.svc:8002 + - type: tcp + addr: scheduler-2.dragonfly.svc:8002 + # schedule timeout + schedule_timeout: 10s + +# when enable, pprof will be enabled, +verbose: true +console: false + +# current host info used for scheduler +host: + # tcp service listen address + # port should be set by other options + listen_ip: 0.0.0.0 + # access ip for other peers + # when local ip is different with access ip, advertise_ip should be set + advertise_ip: 0.0.0.0 + # geographical location and network topology + location: "" + idc: "" + security_domain: "" + net_topology: "" + +# download service option +download: + # download limit per second + total_rate_limit: 1024Mi + per_peer_rate_limit: 1024Mi + # download grpc option + download_grpc: + # security option + security: + insecure: true + cacert: "" + cert: "" + key: "" + tls_config: null + # download service listen address + # current, only support unix domain socket + unix_listen: + socket: /var/run/dfdaemon.sock + # peer grpc option + # peer grpc service send pieces info to other peers + peer_grpc: + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65000 + # if want to limit upper port, please use blow format +# port: +# start: 65000 +# end: 65009 + +# proxy config file location or detail config +# proxy: "" + +# upload service option +upload: + # upload limit per second + rate_limit: 200Mi + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65002 + # if want to limit upper port, please use blow format +# port: +# start: 65020 +# end: 65029 + +# peer task storage option +storage: + # task data expire time + # when there is no access to a task data, this task will be gc. + task_expire_time: 3m0s + multiplex: true + +# proxy service option +proxy: + security: + insecure: true + cacert: "" + cert: "" + key: "" + tcp_listen: + # Namespace stands the linux net namespace, like /proc/1/ns/net + # It's useful for running daemon in pod with ip allocated and listen in host + # Linux only + namespace: /host/ns/net + # listen address + listen: 0.0.0.0 + # listen port, daemon will try to listen + # when this port is not available, daemon will try next port + port: 65001 + # if want to limit upper port, please use blow format + # port: + # start: 65020 + # end: 65029 + registry_mirror: + # url for the registry mirror + url: https://index.docker.io + # whether to ignore https certificate errors + insecure: true + # optional certificates if the remote server uses self-signed certificates + certs: [ ] + # whether to request the remote registry directly + direct: false + + proxies: + # proxy all http image layer download requests with dfget + - regx: (blobs|manifests|config)/sha256.* diff --git a/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/seviceaccount.yaml b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/seviceaccount.yaml new file mode 100644 index 00000000000..c0aaed28919 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/dfdaemon/seviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: dfdaemon diff --git a/deploy/kustomize/single-cluster-openkruise/bases/kustomization.yaml b/deploy/kustomize/single-cluster-openkruise/bases/kustomization.yaml new file mode 100644 index 00000000000..0ef5712fc5a --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/kustomization.yaml @@ -0,0 +1,36 @@ +namespace: dragonfly +resources: +- namespace.yaml +- cdn/rabc.yaml +- cdn/service.yaml +- cdn/serviceaccount.yaml +- cdn/statefulset.yaml +- dfdaemon/seviceaccount.yaml +- dfdaemon/daemonset.yaml +- scheduler/configmap.yaml +- scheduler/service.yaml +- scheduler/statefulset.yaml +generatorOptions: + disableNameSuffixHash: true + labels: + kustomize.resource.generated.by: dragonfly +configMapGenerator: +- name: dfdaemon + files: + - dfdaemon/dfget.yaml +- name: scheduler + files: + - scheduler/scheduler.yaml +- name: cdn + files: + - cdn/nginx.conf + - cdn/cdn.yaml +images: +- name: dragonflyoss/cdn + newTag: latest +- name: dragonflyoss/dfget + newTag: latest +- name: dragonflyoss/scheduler + newTag: latest +- name: bitnami/kubectl + newTag: latest \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/bases/namespace.yaml b/deploy/kustomize/single-cluster-openkruise/bases/namespace.yaml new file mode 100644 index 00000000000..5763fa04184 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: dragonfly \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/bases/scheduler/configmap.yaml b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/configmap.yaml new file mode 100644 index 00000000000..060f6d01653 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/configmap.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: scheduler-static-cdn \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/bases/scheduler/scheduler.yaml b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/scheduler.yaml new file mode 100644 index 00000000000..08bc1a299f5 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/scheduler.yaml @@ -0,0 +1,13 @@ +verbose: true + +server: + port: 8002 + +worker: + workerNum: 4 + workerJobPoolSize: 10000 + senderNum: 10 + senderJobPoolSize: 10000 + +dynconfig: + cdnDirPath: /opt/dragonfly/scheduler-cdn diff --git a/deploy/kustomize/single-cluster-openkruise/bases/scheduler/service.yaml b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/service.yaml new file mode 100644 index 00000000000..af33776b314 --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/service.yaml @@ -0,0 +1,72 @@ +apiVersion: v1 +kind: Service +metadata: + name: scheduler +spec: + selector: + app: dragonfly + component: scheduler + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-0 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-0 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-1 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-1 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: scheduler-2 +spec: + selector: + app: dragonfly + component: scheduler + statefulset.kubernetes.io/pod-name: scheduler-2 + type: ClusterIP + clusterIP: None + ports: + - name: grpc + port: 8002 + protocol: TCP + targetPort: 8002 diff --git a/deploy/kustomize/single-cluster-openkruise/bases/scheduler/statefulset.yaml b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/statefulset.yaml new file mode 100644 index 00000000000..715fe41ee5d --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/bases/scheduler/statefulset.yaml @@ -0,0 +1,40 @@ +# uncomment the follow line, if your k8s is not with openkruise +#apiVersion: apps/v1 +apiVersion: apps.kruise.io/v1alpha1 +kind: StatefulSet +metadata: + name: scheduler + labels: + app: dragonfly + component: scheduler +spec: + serviceName: scheduler + selector: + matchLabels: + app: dragonfly + component: scheduler + replicas: 3 + template: + metadata: + labels: + app: dragonfly + component: scheduler + spec: + containers: + - name: scheduler + image: dragonflyoss/scheduler + imagePullPolicy: "Always" + ports: + - containerPort: 8002 + volumeMounts: + - name: config + mountPath: /etc/dragonfly + - name: cdn-config + mountPath: /opt/dragonfly/scheduler-cdn + volumes: + - name: config + configMap: + name: scheduler + - name: cdn-config + configMap: + name: scheduler-static-cdn \ No newline at end of file diff --git a/deploy/kustomize/single-cluster-openkruise/overlays/sample/kustomization.yaml b/deploy/kustomize/single-cluster-openkruise/overlays/sample/kustomization.yaml new file mode 100644 index 00000000000..0fa40282b7f --- /dev/null +++ b/deploy/kustomize/single-cluster-openkruise/overlays/sample/kustomization.yaml @@ -0,0 +1,12 @@ +resources: +- ../../bases +images: +- name: dragonflyoss/cdn + newName: sample.com/d7y/cdn + newTag: latest +- name: dragonflyoss/dfget + newName: sample.com/d7y/dfget + newTag: latest +- name: dragonflyoss/scheduler + newName: sample.com/d7y/scheduler + newTag: latest diff --git a/docs/en/README.md b/docs/en/README.md index 6eb5046b334..a90566e13c1 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -13,7 +13,7 @@ Organization of document is as following: * [TODO manager](./cli-reference/manager.md) * [TODO API Reference](#API-Reference) * [Ecosystem](#Ecosystem) - * [WIP Kubernetes Integration](./ecosystem/Kubernetes-with-Dragonfly.md) + * [Kubernetes Integration](./ecosystem/Kubernetes-with-Dragonfly.md) * [WIP Harbor Integration](./ecosystem/Harbor-with-Dragonfly.md) * [Developer Guide](#Developer-Guide) * [Design Doc](#Design-Doc) @@ -25,7 +25,7 @@ Find `WIP` or `TODO` in this page and follow [CONTRIBUTING](../../CONTRIBUTING.m ## Quick Start -[TODO Quick Started](./quick-start) is exactly what you need if you would give Dragonfly a try. This document includes what are the prerequisites, how to install Dragonfly and how to experience Dragonfly's usage. +[Quick Started](./user-guide/quick-start.md) is exactly what you need if you would give Dragonfly a try. This document includes what are the prerequisites, how to install Dragonfly and how to experience Dragonfly's usage. ## [WIP] User Guide diff --git a/docs/en/ecosystem/Kubernetes-with-Dragonfly.md b/docs/en/ecosystem/Kubernetes-with-Dragonfly.md index ded75d7d589..d1c63890dfb 100644 --- a/docs/en/ecosystem/Kubernetes-with-Dragonfly.md +++ b/docs/en/ecosystem/Kubernetes-with-Dragonfly.md @@ -1 +1,82 @@ -# [WIP] Kubernetes with Dragonfly \ No newline at end of file +# Kubernetes with Dragonfly + +Now we can deploy all components of Dragonfly in Kubernetes cluster. We deploy scheduler and cdn as `StatefulSets`, +daemon as `DaemonSets`. + +Table of contents: + +* [Kustomize](#kustomize-support) +* [TODO Helm](#helm-support) +* [TODO Upgrade Guide](#upgrade-guide) + +## Kustomize Support + +### Prepare Kubernetes Cluster + +If there is no available Kubernetes cluster for testing, [minikube](https://minikube.sigs.k8s.io/docs/start/) is +recommended. Just run `minikube start`. + +### Build and Apply Kustomize Configuration + +```shell +git clone https://github.com/dragonflyoss/Dragonfly2.git +kustomize build Dragonfly2/deploy/kustomize/single-cluster-native/overlays/sample | kubectl apply -f - +``` + +### Wait Dragonfly Ready + +Wait all pods running + +``` +kubectl -n dragonfly wait --for=condition=ready --all --timeout=10m pod +``` + +### Configure Runtime + +Use Containerd with CRI as example, more runtimes can be found [here](../user-guide/quick-start.md) + +For private registry: + +```toml +[plugins."io.containerd.grpc.v1.cri".registry.mirrors."harbor.example.com"] +endpoint = ["http://127.0.0.1:65001", "https://harbor.example.com"] +``` + +For docker public registry: + +```toml +[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] +endpoint = ["http://127.0.0.1:65001", "https://registry-1.docker.io"] +``` + +Add above config to `/etc/containerd/config.toml` and restart Containerd + +```shell +systemctl restart containerd +``` + +### Using Dragonfly + +After all above steps, create a new pod with target registry. Or just pull an image with `crictl`: + +```shell +crictl harbor.example.com/library/alpine:latest +``` + +```shell +crictl pull docker.io/library/alpine:latest +``` + +After pulled images, find logs in dfdaemon pod: +```shell +# find pods +kubectl -n dragonfly get pod -l component=dfdaemon +# find logs +pod_name=dfdaemon-xxxxx +kubectl -n dragonfly exec -it ${pod_name} -- grep "peer task done" /var/log/dragonfly/daemon/core.log +``` + +Example output: +``` +{"level":"info","ts":"2021-06-28 06:02:30.924","caller":"peer/peertask_stream_callback.go:77","msg":"stream peer task done, cost: 2838ms","peer":"172.17.0.9-1-ed7a32ae-3f18-4095-9f54-6ccfc248b16e","task":"3c658c488fd0868847fab30976c2a079d8fd63df148fb3b53fd1a418015723d7","component":"streamPeerTask"} +``` \ No newline at end of file diff --git a/docs/en/user-guide/quick-start.md b/docs/en/user-guide/quick-start.md index de6f5fdee01..307a05e32d9 100644 --- a/docs/en/user-guide/quick-start.md +++ b/docs/en/user-guide/quick-start.md @@ -1,3 +1,18 @@ # [WIP] Dragonfly Quick Start -Dragonfly Quick Start document aims to help you to quick start Dragonfly journey. This experiment is quite easy and simplified. \ No newline at end of file +Dragonfly Quick Start document aims to help you to quick start Dragonfly journey. This experiment is quite easy and +simplified. + +You can have a quick start following [Kubernetes-with-Dragonfly](../ecosystem/Kubernetes-with-Dragonfly.md) + +This table describes some container runtimes version and documents. + +| Runtime | Version | Document | CRI Support | Pull Command | +| --- | --- | --- | --- | --- | +| Docker | All | [Link](./proxy/docker.md) | No | docker pull docker.io/library/alpine | +| Containerd without CRI | All | [Link](./proxy/containerd.md) | No | ctr image pull docker.io/library/alpine | +| Containerd with CRI | v1.1.0+ | [Link](./registry-mirror/containerd.md) | Yes | crictl pull docker.io/library/alpine:latest | +| CRI-O | All | [Link](./registry-mirror/cri-o.md) | Yes | crictl pull docker.io/library/alpine:latest | + +When using Dragonfly in Kubernetes, we recommend to use `Containerd with CRI` and `CRI-O`, deploying document can be +found in [Kubernetes-with-Dragonfly](../ecosystem/Kubernetes-with-Dragonfly.md). \ No newline at end of file diff --git a/docs/en/user-guide/registry/cri-containerd.md b/docs/en/user-guide/registry-mirror/containerd.md similarity index 53% rename from docs/en/user-guide/registry/cri-containerd.md rename to docs/en/user-guide/registry-mirror/containerd.md index 9d90c408375..8f3e3ac9361 100644 --- a/docs/en/user-guide/registry/cri-containerd.md +++ b/docs/en/user-guide/registry-mirror/containerd.md @@ -1,4 +1,6 @@ -# Use dfget daemon as registry mirror for cri-containerd +# Use dfget daemon as registry mirror for Containerd with CRI support + +From v1.1.0, Containerd supports registry mirrors, we can configure Containerd via this feature for HA. ## Quick Start @@ -19,16 +21,29 @@ proxy: - regx: blobs/sha256.* ``` +Run dfget daemon + +```shell +dfget daemon +``` + ## Step 2: Configure Containerd -Then, enable mirrors in containerd registries configuration in -`/etc/containers/registries.conf`: +Then, enable mirrors in Containerd registries configuration in +`/etc/containerd/config.toml`: ```toml -[plugins.cri.registry.mirrors."docker.io"] - endpoint = ["http://127.0.0.1:65001"] +[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] + endpoint = ["http://127.0.0.1:65001","https://registry-1.docker.io"] ``` +In this config, there is two mirror endpoints for "docker.io", Containerd will pull images with `http://127.0.0.1:65001` first. +If `http://127.0.0.1:65001` is not available, the default `https://registry-1.docker.io` will be used for HA. + +> More details about Containerd configuration: https://github.com/containerd/containerd/blob/v1.5.2/docs/cri/registry.md#configure-registry-endpoint + +> Containerd has deprecated the above config from v1.4.0, new format for reference: https://github.com/containerd/containerd/blob/v1.5.2/docs/cri/config.md#registry-configuration + ## Step 3: Restart Containerd Daemon ``` diff --git a/docs/en/user-guide/registry/cri-o.md b/docs/en/user-guide/registry-mirror/cri-o.md similarity index 100% rename from docs/en/user-guide/registry/cri-o.md rename to docs/en/user-guide/registry-mirror/cri-o.md diff --git a/hack/update-kustomize-native.sh b/hack/update-kustomize-native.sh new file mode 100755 index 00000000000..c1b804f15ab --- /dev/null +++ b/hack/update-kustomize-native.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +dir=$(dirname $(readlink -f "$0")) +root=$(cd "$dir" && cd .. && pwd) + +if [[ -z "$root" ]]; then + exit 1 +fi + +src=$root/deploy/kustomize/single-cluster-openkruise +dst=$root/deploy/kustomize/single-cluster-native + +rm -rf "$dst" + +mkdir -p $dst/overlays + +cp -r "$src/bases" "$dst/bases" +#cp -r "$src/overlays/minikube" "$dst/overlays/minikube" +cp -r "$src/overlays/sample" "$dst/overlays/sample" + +sed -i 's#apps.kruise.io/v1.*#apps/v1#' \ + "$dst/bases/cdn/statefulset.yaml" \ + "$dst/bases/dfdaemon/daemonset.yaml" \ + "$dst/bases/scheduler/statefulset.yaml" + +sed -i '1,2d' \ + "$dst/bases/cdn/statefulset.yaml" \ + "$dst/bases/dfdaemon/daemonset.yaml" \ + "$dst/bases/scheduler/statefulset.yaml"