bkeagent

command module
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: MulanPSL-2.0 Imports: 31 Imported by: 0

README

bkeagent

指令

① command crd只可以顺序执行,当前CRD未执行完成不可执行下一个CRD

② command中多个指令也必须是顺序执行,当前指令未执行完成不可执行下一个指令

③ 指令类型分为内置指令、k8s操作指令、SHELL指令

④ 关于内置指令有哪些,后续在讨论

镜像构建

构建参数
  • GOPRIVATE:配置Go语言私有仓库,相当于GOPRIVATE环境变量
  • COMMIT:当前git commit的哈希值
  • VERSION:组件版本
  • SOURCE_DATE_EPOCH:镜像rootfs的时间戳
构建命令
  • 构建并推送到指定OCI仓库

    使用docker
    docker buildx build . -f <path/to/dockerfile> \
        -o type=image,name=<oci/repository>:<tag>,oci-mediatypes=true,rewrite-timestamp=true,push=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest \
        --build-arg=SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
    
    使用nerdctl
    nerdctl build . -f <path/to/dockerfile> \
        -o type=image,name=<oci/repository>:<tag>,oci-mediatypes=true,rewrite-timestamp=true,push=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest \
        --build-arg=SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
    

    其中,<path/to/dockerfile>为Dockerfile路径,<oci/repository>为镜像地址,<tag>为镜像tag

  • 构建并导出OCI Layout到本地tarball

    使用docker
    docker buildx build . -f <path/to/dockerfile> \
        -o type=oci,name=<oci/repository>:<tag>,dest=<path/to/oci-layout.tar>,rewrite-timestamp=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest \
        --build-arg=SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
    
    使用nerdctl
    nerdctl build . -f <path/to/dockerfile> \
        -o type=oci,name=<oci/repository>:<tag>,dest=<path/to/oci-layout.tar>,rewrite-timestamp=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest \
        --build-arg=SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
    

    其中,<path/to/dockerfile>为Dockerfile路径,<oci/repository>为镜像地址,<tag>为镜像tag,path/to/oci-layout.tar为tar包路径

  • 构建并导出镜像rootfs到本地目录

    使用docker
    docker buildx build . -f <path/to/dockerfile> \
        -o type=local,dest=<path/to/output>,platform-split=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest
    
    使用nerdctl
    nerdctl build . -f <path/to/dockerfile> \
        -o type=local,dest=<path/to/output>,platform-split=true \
        --platform=linux/amd64,linux/arm64 \
        --provenance=false \
        --build-arg=GOPRIVATE=gopkg.openfuyao.cn \
        --build-arg=COMMIT=$(git rev-parse HEAD) \
        --build-arg=VERSION=0.0.0-latest
    

    其中,<path/to/dockerfile>为Dockerfile路径,path/to/output为本地目录路径

部署

参考:https://docs.openfuyao.cn/docs

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1beta1
Package v1beta1 contains API Schema definitions for the agent v1beta1 API group +kubebuilder:object:generate=true +groupName=bkeagent.bocloud.com
Package v1beta1 contains API Schema definitions for the agent v1beta1 API group +kubebuilder:object:generate=true +groupName=bkeagent.bocloud.com
pkg
job
download
Package download provides functions for downloading files.
Package download provides functions for downloading files.
log
net